Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Select question
Message
 
 
À
29/05/2003 04:53:03
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00793758
Message ID:
00794071
Vues:
27
Fabio,
I will try your SQL select. But I thought I tried it pretty much as you have it and I was getting much of duplication. The only thing I was not using is aliases for the tables. Maybe this make a difference. I will try it.

Thank you for your help.

>Hi Dmitry,
>
>
>SELECT P.partno, SUM(U.qUsed) totUse, SUM(R.qReceived) totRec FROM parts P
>LEFT JOIN partsUses U;
> ON U.dateUsed BEETWEN m.dateInit AND m.dateEnd AND U.partNo=P.partNo;
>LEFT JOIN partsReceived R;
> ON R.dateReceived BEETWEN m.dateInit AND m.dateEnd AND R.partNo=P.partNo;
>GROUP BY 1; && result are in order
>INTO CURSOR result
>
>
>If you want remove parts not moved:
>
>
>SELECT P.partno, SUM(U.qUsed) totUse, SUM(R.qReceived) totRec FROM parts P
>JOIN partsUses U;
> ON U.dateUsed BEETWEN m.dateInit AND m.dateEnd AND U.partNo=P.partNo;
>JOIN partsReceived R;
> ON R.dateReceived BEETWEN m.dateInit AND m.dateEnd AND R.partNo=P.partNo;
>GROUP BY 1; && result are in order
>INTO CURSOR result
>
>
>Attention: No put DATE() on SELECT command !
>
>Fabio
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform