CTE

SQLServerCentral Article

Navigating Trees With CTE

  • Article

Introduction This article shows how common table expressions (CTE) in SQL Server are naturally suited for navigating trees, such as finding its longest path, or diameter. Recall that a tree is an undirected graph where unique paths exist between any two nodes (i.e. vertices). Any node may be selected as its top node, with its […]

4.8 (5)

You rated this post out of 5. Change rating

2021-04-19

7,337 reads

Blogs

Familiar Sights

By

Yesterday was a long day in London. I arrived late in the am, and...

Derby City Data Days

By

It was awesome to see the Kentucky data community come out for the first...

Tomorrow: Webcast on SQL Server security

By

Tomorrow, April 16, 2024, I will be giving another webcast; this one will be...

Read the latest Blogs

Forums

Difference between equal directly and use SUBSTRING

By Martass

Hello, I have a script that was running really long, and I have found...

Visualisation options as an alternative to SanKey diagram

By aaron.reese

I am building a report to show customer journeys and their arrears levels. I...

should i prefer join or left join over exists or in

By rajemessage 14195

hi, I have seen people use exists when exists is required and no cols...

Visit the forum

Question of the Day

Express In-Memory OLTP

Can I create In-Memory OLTP tables in SQL Server Express?

See possible answers