如何在SubSonic查询中使用select with multi table?

时间:2009-05-14 02:45:27

标签: subsonic

我是SubSonic的新手,遇到查询问题。这是我的查询字符串

string sql = "SELECT *" +
             " FROM tbl_exrates, tbl_currency" +
             " WHERE date = " + d;
             " AND tbl_exrates.currency = tbl_currency.cid" +
             " AND (cash > 0 OR transfer > 0 OR sell > 0)";

如何将其转换为SubSonic查询字符串? SS有功能支持吗?

谢谢!

3 个答案:

答案 0 :(得分:3)

q = new Select().From(TblExrate.Schema)
        .InnerJoin(TblCurrency.Schema)
        .Where(tbl_exrates.date).IsEqualTo(d)
        .AndExpression(tbl_exrates.cash).IsGreaterThan(0)
        .Or(tbl_exrates.transfer).IsGreaterThan(0)
        .Or(tbl_exrates.cash).IsGreaterThan(0);

答案 1 :(得分:1)

看起来您可以在Subsonic中执行快速复杂的查询:

http://subsonicproject.com/querying/select-queries/

答案 2 :(得分:1)

您应该遵循此link。它包含您要查找的所有选择查询。