Category: MS SQL Server

Group concatenation in T-SQL using CTE

In Oracle you have listagg() and in MySQL you have group_concat() to create string aggregations. But what do you have in T-SQL? The simple answer is nothing, yet, and we’re all hoping for a change in the future. But until then it’s up to us to do it by hand. In a previous post I




How to use recursive CTE calls in T-SQL

A common table expression (CTE) in T-SQL is used by many to get around the internal referencing problem in derived tables. It also gives you a better overview of your query compared to having nested derived tables. But one really nice feature with CTEs is that you can let it call itself recursively and nest




%d bloggers like this: