Basic Select
Query
Yields
Default Conjunction
By default "AND" is used, but that can be overridden.
Query
Yields
Query - Sets the DefaultConjunction to "OR"
Yields
Count
Query
Yields
Query
Yields
Aggregates
Avg, Count, Min, Max, Sum, StdDev, and Var all share the same syntax.
Query - An Aggregate with an Empty Alias uses the Column Name
Yields
Query - Simple Aggregate with Alias
Yields
Query - Two Aggregates
Yields
Query - Aggregate with Distinct
Yields
Query - Aggregate with Count
Yields
Query - Aggregate with Where clause
Yields
Group By
Query
Yields
Query - With two GroupBy's and a Where clause
Yields
Query - Select, Where, GroupBy, and OrderBy
Yields
Query - Select, Where, GroupBy, WithRollup, and OrderBy
Yields
Operators in Queries
Query
Yields
Query
Yields
Distinct and Top in Queries
Query - Distinct Rows
Yields
Query - Top 5
Yields
Mixing And/Or Queries
Query
Yields
Simplifying Queries
Let's simplify the query above to something more readable. Of course, the queries below yield the same sql so it's not relisted
Query - Cache the Query object in a local variable
Query - Better yet, add a method directly to your concrete query class
Conditionally Building and Reseting Queries
Queries can be built up by adding individual Select or Where clauses. To flush a Query out, use QueryReset().