Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Union Clause and Group by clause
Message
De
30/07/2006 08:45:33
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01141596
Message ID:
01141602
Vues:
18
This message has been marked as a message which has helped to the initial question of the thread.
Hi Bernhart,

I think you'll want to do this in two statements. First do the UNION without the grouping and then do the SUM and GROUP on the resultant cursor.



>Hi all,
>
>I Have Horaire.dbf
>iemployeeid I
>ipauseid I
>ipauseid2 I
>ddate D
>n100 N(8,2)
>n120 n(8,2)
>n100_2 N(8,2)
>n120_2 N(8,2)
>
>I want the sum of n100 + n120 + n100_2 n120_2 per each iemployeeid , ddate , iplanpauseid
>
>
>
> D_debut = {^2006/06/01}
>  d_fin = {^2006/06/30}
>
>SELECT  Horaire.iemployeeid , ;
>    Horaire.ddate,;
>    PAUSE.iplanpauseid , ;
>    SUM( Horaire.n100 + Horaire.n120 ) AS 'totheure';
>    FROM AMLINE!PAUSE ;
>    INNER JOIN AMLINE!Horaire  	ON  PAUSE.iid = Horaire.cpauseid ;
>    WHERE Horaire.ddate BETW  D_debut AND  d_fin ;
>    GROUP BY 1 , 2 , 3 ;
>       UNION ;
>    SELECT  Horaire.iemployeeid , ;
>    Horaire.ddate,;
>    PAUSE.iplanpauseid , ;
>    SUM( Horaire.n100_2 + Horaire.n120_2 ) AS 'totheure';
>    FROM AMLINE!PAUSE ;
>    INNER JOIN AMLINE!Horaire  	ON  PAUSE.iid = Horaire.cpauseid2 ;
>    WHERE Horaire.ddate BETW  D_debut AND  d_fin ;
>       GROUP BY 1,2,3 ;
>    INTO CURSOR temp3
>
>
>
>This result is bad because itis not group by on 01/06/2006 ...???
>
>http://www.amline.be/Ng/union.jpg
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform