Customizing common SQL clauses
1. Problem Overview
Section titled “1. Problem Overview”Working with EasyQuery, sometimes you need to add to generated SQL some additional clauses, which are common for the whole query (DISTINCT, TOP, etc)
2. Setting DISTINCT clause
Section titled “2. Setting DISTINCT clause”To implement this you need to use Options.SelectDistinct
property of a DbQuery object:
query.Options.SelectDistinct = true;
3. Setting LIMIT and/or TOP clauses
Section titled “3. Setting LIMIT and/or TOP clauses”You can add TOP or LIMIT clause into result SQL statement using the following commands:
query.Options.SelectTop = "100";
Or
query.Options.LimitClause = "20";