Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query without max()
Message
From
16/09/2019 13:57:39
 
 
To
16/09/2019 11:44:39
Walter Meester
HoogkarspelNetherlands
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01670845
Message ID:
01670899
Views:
88
>Cetin
>
>You are refering to a recursive query, which I (I admit the mischaracterization as recursive CTEs can be use in creating records as well) referred to as for solving hierarchical problems. This is where I almost exclusively use them for.
>
>The challenge was to find me an example where using CTE as a subquery would lead to any significant advantage.

I've run into cases where I need the same subquery in multiple parts of a query. A CTE lets me write it once and use it repeatedly. Don't have an example handy, but it shouldn't be hard to think of one.

FWIW, I also find queries with CTEs (especially when there are several) far more readable than queries with lots of derived table. The case where I think readability is most aided is when otherwise, I'd have a long nested set of queries. In my view, those are so hard to read, and the CTE lays things out neatly so you can follow what's happening.

Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform