Category: TSQL

T-SQL Tuesday #016: Aggregates and Windowing Functions and Ranking! Yum!

Let’s get this out of the way right now: I am SO going to take advantage of this T-SQL Tuesday on aggregates to talk about OVER() and PARTITION BY. Aggregates and OVER go together like french fries and catsup…sure, you can have them apart, but together they’re just magical. Note: If you’re not at all familiar […]

T-SQL: CASE Statement

This is a companion piece to the MidnightDBA video T-SQL: CASE Statement. In short, a CASE statement is a simplified set of IF statements. Instead of using several IF statements, you can have a single statement that evaluates several criteria against a piece of data.  Simple CASE Let’s take a simple example. We want to […]