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;
>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;
>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