Common Table Expressions (CTE)

Technical Article

Function and Queries to Convert Hierarchical Adjacency to Nested Json Arrays

  • Script

This script converts hierarchical adjacency into nested json rows which contain the recursive "downlines" of each node.  The table-valued function treats each row in the original adjacency as the root node in a recursive common table expression. 

2019-11-25 (first published: )

493 reads

Technical Article

Function and Queries to Convert Hierarchical Adjacency to Nested Json Arrays

  • Script

This script converts hierarchical adjacency into nested json rows which contain the recursive "downlines" of each node.  The table-valued function treats each row in the original adjacency as the root node in a recursive common table expression. 

2019-11-12 (first published: )

1,506 reads

Stairway to Advanced T-SQL

Stairway to Advanced T-SQL Level 3: Understanding Common Table Expressions (CTEs)

  • Stairway Step

A CTE is a temporary result set defined by a simple query, and is used within the execution scope of a single INSERT, UPDATE, DELETE, or SELECT statement. In this article we will explore how to define and use CTE's.

2015-03-18

2,625 reads

Blogs

PGSQL Phriday #001: Two Truths and a Lie

By

As a part of my own journey of learning within PostgreSQL, I’ve decided that...

Daily Coping 7 Oct 2022

By

Today’s coping tip is to be willing to share how you feel and ask...

T-SQL Tuesday #155 –The Dynamic Code Invitation

By

Apologies for the late invitation. A minor snafu has me hosting again. This is...

Read the latest Blogs

Forums

Any reason to use AWS WAF over Cloudflare?

By obalikawa

I'm primarily using Cloudflare for security. I was wondering if AWS WAF is any...

OP identification

By kaj

In lengthy discussions and in developing trial and error scenarios I sometimes find it...

Visit the forum

Ask SSC Logo Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers