Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can always check what query subsonic generates for you with the <code>BuildSqlStatement()</code> method:</p> <pre><code>SqlQuery query = DB.Select().From&lt;Product&gt;(); String output = query.BuildSqlStatemtent(); </code></pre> <p>But I think I know what the problem is: SubSonic2 Join methods don't support joining on multiple columns as far as I know: <a href="https://stackoverflow.com/questions/2780028/subsonic-2-join-on-multiple-columns">subsonic 2 join on multiple columns</a></p> <p>So you basically you have two options.</p> <p>a) do a "comma join"</p> <pre><code>SELECT * FROM table1 INNER JOIN table2 ON table1.id = table2.table1_id </code></pre> <p>is the same as this query below but more readable</p> <pre><code>SELECT * FROM table1, table2 WHERE table1.id = table2.table1_id </code></pre> <p>At least that's true for mysql</p> <p>Edit: That won't work with subsonic as I figured out in my question (but have forgetten)</p> <p><a href="http://www.mysqlperformanceblog.com/2010/04/14/is-there-a-performance-difference-between-join-and-where/" rel="nofollow noreferrer">http://www.mysqlperformanceblog.com/2010/04/14/is-there-a-performance-difference-between-join-and-where/</a></p> <p>b) Use an InlineQuery which is subsonic's backdoor to execute plain sql.</p> <pre><code> private class Process { public Int64 Id { get; set; } public string User { get; set; } public string Host { get; set; } public string Db { get; set; } public string Command { get; set; } public string State { get; set; } public string Info { get; set; } } var result = DB.Query().ExecuteTypedList&lt;Process&gt;("SHOW FULL PROCESSLIST"); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload