SQL Basics - Difference between WHERE, GROUP BY and HAVING clause

All these three Clauses are a part/extensions of a SQL Query, are used to Filter, Group & re-Filter rows returned by a Query respectively, and are optional. 432 more words


Transact SQL - Group By with Rollup


Still working on Utilization reports and needing to build a single report that has the flexibility to support different aggregation levels.

I know I can do so from my reporting tool, but wanted to explore how to I can accomplish same from the SQL Server Engine. 445 more words


How SQL GROUP BY Should Have Been Designed - Like Neo4j's Implicit GROUP BY

In the recent past, we’ve explained the syntactic implications of the SQL GROUP BY clause. If you haven’t already, you should read our article “ 792 more words


Generating Column Totals

Basic Column Totals

With the help of SUM statement we can generate total value of columns. SUM statement is used in PROC PRINT step.

Subtotals… 92 more words


mySQL group by excluding null values

GROUP BY (case when l.log_id_if_relog is null then l.id else l.log_id_if_relog end)

Exclude Null

GROUPING SETS equivalent | for SQL Server 2005 and below

Sometime back I discussed about [GROUPING SETS] in my previous post and today one reader of this blog asked me how we can create the same result-set without using… 225 more words

SQL Server 2005