如何使用subsonic2.1构建这样的查询

时间:2009-09-05 18:53:11

标签: subsonic

SELECT * FROM sometable where a=1 and (a=2 or (b=1 and c=2))

如何构建我需要的查询? (没有内联查询)

1 个答案:

答案 0 :(得分:1)

DB.Select().From(sometable.Schema)    
  .Where(sometable.a).IsEqualTo(1)  
  .AndExpression(sometable.a).IsEqualTo(2)  
  .OrExpression(sometable.b).IsEqualTo(1)  
  .And(sometable.c).IsEqualTo(2);