Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Union Clause and Group by clause
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Union Clause and Group by clause
Miscellaneous
Thread ID:
01141596
Message ID:
01141596
Views:
62
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
Next
Reply
Map
View

Click here to load this message in the networking platform