tags:

views:

42

answers:

1

How to make this select in SubSonic using SqlQuery ?

SELECT * FROM [dbo].[Tablexxx]

Join Tableyyy on Tablexxx.fieldZZZ = Tableyyy.fieldZZZ

WHERE Tablexxx.fieldxxx = 1 AND

(Tablexxx.fieldyyy = 'S' or Tablexxx.fieldyyy = 'T')

Thanks any help.

Valmir

+1  A: 
var query = DB.Select().From<Table1>()
                       .InnerJoin<Table2>()
                       // Where() takes a ColumnSchema type
                       .Where(Table1.FieldXColumn).IsEqualTo(1)
                       // AndExpression only takes strings, so use the column struct
                       .AndExpression(Table1.Columns.FieldY).IsEqualTo("S")
                       .Or(Table1.FieldYColumn).IsEqualTo("T")
                       .ExecuteAsCollection();
John Sheehan
Works very well, thank you John.....
Valmir