Left join in SubSonic Problem

join;subsonic

I'm a beginner in SubSonic and I'm using version 2.1. I'd like to perform a left join in this query. The query looks like:

select ... 
from tableA
left join tableB on tableA.Cola=tableB.Colb and tableB.Colc='some value'

I want to know how to perform the and tableB.Colc='some value' condition. I tried something like this:

new SubSonic.Select().From("tableA").LeftOuterJoin
("tableB","Colb","tableA","Cola").AndExpression("Colc").IsEqualTo("some value")

but the generated statement is not what I wanted.

Best Answer

This may not be exactly what you want , but the best way to do things like this in subsonic is with views, So create the select as a view and then use the view object in your code. In 3+ the linq makes it alot easier to accomplish what you are trying

Related Topic