Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select with additional conditions
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01268865
Message ID:
01268988
Vues:
13
Is that correct? I thought that SQL aliases have nothing to do with A-J aliases for work areas.

>It's a bad idea to use one leter meaningless table aliases in a query. It makes the query totally unreadable. It also could be dangerous because letters A-J are reserved for workareas 1-10.
>
>>
>>I have an SQL request, which is getting more complicated by the day.
>>
>>To simplify my request,I have an SQL statement that selects a set of conditions from 2 joined tables finally LEFT OUTER JOINED to another Sub-select statement grouped by a summed field.
>>
>>Now I would like the SUB SELECT STATEMENT to satisfy this condition - that the sub-Select Table only tabulates conditions where the child table has records corresponding to the primary select main table has a date between the Start Date and the End date of the child table in the sub-select.
>>
>>Anyway, I am enclosing the code here, after removing some fields to make easy reading.
>>
>>Any help will be greatly appreciated.
>>
>>
>>SET enginebehavior 70
>>
>>SELECT A.ddate,;
>>B.Block,;
>>C.cname as name,;
>>C.narea as area,;
>>ROUND(D.plants,2) as TotPlants,;
>>FROM Dailywork2 A ;
>>Inner Join Block2 B ;
>>On A.cblock=B.block ;
>>Left Outer JOIN ;
>>BlockProfile C ON A.cblock = C.cparent;
>>Left OUTER Join ;
>>(select C.cparent,sum(C.narea*(43560/(C.nspx*C.nspy)),0))+(SUM(C.nrdmPlants)) as Plants ;
>>FROM BlockProfile C  group by cparent ) D ;
>>on D.cparent=A.cblock ;
>>WHERE A.ddate < C.dstart
>>
>>
>>
>>i.e. I require D to only sum data for which A.ddate falls between BlockProfile dStart and dEnd. My request is only for the sub select data
>>
>>Thanks a lot,
>>
>>Steve
Doru
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform