Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Correlated subquery
Message
From
18/03/2021 09:04:56
 
 
To
17/03/2021 18:14:32
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01679045
Message ID:
01679070
Views:
56
>>Hi Naomi,
>>
>>Perhaps one last question: does it matter or is it best practice to give aliases to the tables that are used in the subquery - it seems to work either way. Or is it just to be clear and to shorten the table names to short aliases?
>
>I tend to aliases everything. I hate typing OrderHeaders over and over. Never use A, B, C as they have no immediate meaning. Plaintiffs would get old fast. PL and PF etc, etc. I always specify the join type.
>
The above already reason for me as well, but if handling stratified data sets - might be for table size, backup, "year already booked" or other reasons, feeding other tables into same query always makes me grin
lcYear = Alltrim(m.tnYear)
Select cust.x, cust.y ;
    , count(ords.*) as cnt_ord, sum(ord.gross) as sumgross ;
    from customer cust ;
    Join ("Order"+m.lcYear)  ords on... ;
    group by 1,2 ;
    into table ("Res_"+m.lcYear)
Previous
Reply
Map
View

Click here to load this message in the networking platform