Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query without max()
Message
De
15/09/2019 15:14:03
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
15/09/2019 14:45:29
Walter Meester
HoogkarspelPays-Bas
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01670845
Message ID:
01670876
Vues:
62
>One thing I really hate about CTE is that you can't nest the result of a CTE query as the inner of another query. Its something I frequently do in our framework to build SQL statements dynamically (our Query Designer). One way to avoid that is to get the CTE in an inline function and abstract it away.
>
>
>SELECT * FROM x
>
>
>You can use the result as a subquery
>
>
>SELECT * FROM (SELECT FROM x) as Y WHERE ...
>
>
>but you can't do this
>
>
>SELECT * FROM (WITH CTE (...) as (...) SELECT * FROM CTE) as Y WHERE ...
>
>
>Or use them as arguments in EXISTS(...), IN(...) etc.
>
>Then you'll have to abstract it away
>
>
>SELECT * FROM (SELECT * FROM dbo.MyCTEFunction(...)) as y WHERE ...
>
>
>YMMV,
>
>Walter,

OK with these last part I can see you are really not aware what a CTE is and what you can do with them. Your biggest problem is with the syntax, you are trying to write it as a subquery.

Let's agree to disagree.
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform