Perform a single pick where
I would like to get the following SQL statement with subsonic 2.2
SELECT Product.* FROM Product WHERE Product.OurPrice <> Product.RetailPrice
The subsonic select query I started with:
SubSonic.SqlQuery select = new SubSonic.Select()
.From<Product>()
.Where(Product.Columns.OurPrice)
.IsNotEqualTo(... object /*Should be Product.Columns.RetailPrice, but that giving and exception*/...);
My question is how to tell SubSonic 2.2 to create a where clause for another column in the same table.
0
a source to share
3 answers
It looks like you are trying to compare two columns in your query. This is not possible in SubSonic 2.2 unless you use an inline query:
http://subsonicproject.com/docs/Inline_Query_Tool
You can also use the view or table function.
0
a source to share
The solution to the problem above:
ProductCollection products = new SubSonic.InlineQuery().ExecuteAsCollection<ProductCollection>
(@"SELECT Product.ProductId, ... Product.ModifiedBy, Product.ModifiedOn, Product.IsDeleted FROM Product WHERE (Product.OurPrice <> Product.RetailPrice)");
Repeater1.DataSource = products;
Repeater1.DataBind();
0
a source to share