Select

  1. selectQuery.Select(f => f.Column("ProductID"))
  2.     .From(f => f.Table("Order Details"));

Output (MS SQL)

  1. SELECT
  2.     [ProductID]
  3. FROM
  4.     [Order Details]
  5. WHERE
  6.     ([ProductID] > @p0)

 

Select with where clause

  1. selectQuery.Select(f => f.Column("ProductID"))
  2.     .From(f => f.Table("Order Details")).Where(e => e.Column("ProductID") > 10);

 

Output (MS SQL)

  1. SELECT
  2.     [ProductID]
  3. FROM
  4.     [Order Details]
  5. WHERE
  6.     ([ProductID] > @p0)

Select with sub query

  1. selectQuery.Select(e => e.Column("ProductID"))
  2.     .From(e => e.Table("Order Details", "od"))
  3.     .Where(
  4.         f =>
  5.         f.Exists(                       
  6.                 f.Select(f.Constant(1)).From(f.Table("Orders", "o"))
  7.                 .Where(f.Column("o","OrderId") == f.Column("od","OrderID"))));

Output (MS SQL)

  1. SELECT
  2.     [ProductID]
  3. FROM
  4.     [Order Details] AS od
  5. WHERE
  6.     EXISTS(SELECT
  7.     @p0
  8. FROM
  9.     [Orders] AS o
  10. WHERE
  11.     ([o].[OrderId] = [od].[OrderID]))

Last edited Jan 24, 2011 at 6:16 PM by seesharper, version 1

Comments

No comments yet.