Shinichi
Shinichi

Reputation: 505

How to using select with multi table in SubSonic query?

I am new with SubSonic and have a problem with query. This is my query string

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)";

How to convert it to SubSonic Query string ? Does SS have function support to do that ?

Thanks !

Upvotes: 0

Views: 917

Answers (1)

Adam Cooper
Adam Cooper

Reputation: 8677

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);

Upvotes: 3

Related Questions