Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select sql problem
Message
 
 
À
06/01/2004 01:49:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00864103
Message ID:
00864136
Vues:
14
Try
ldStartP1 = {^2003/11/01}
ldEndP1   = {^2003/11/30}
ldStartP2 = {^2003/12/01}
ldEndP2   = {^2003/12/31}

SELECT empno, DAY(date) as day, ;
	MAX(IIF(BETWEEN(date, ldStartP1, ldEndP1), A, SPACE(2)) AS A11 ;
	MAX(IIF(BETWEEN(date, ldStartP1, ldEndP1), T, SPACE(2)) AS T11 ;
	MAX(IIF(BETWEEN(date, ldStartP1, ldEndP1), U, SPACE(2)) AS U11 ;
	MAX(IIF(BETWEEN(date, ldStartP2, ldEndP2), A, SPACE(2)) AS A12;
	MAX(IIF(BETWEEN(date, ldStartP2, ldEndP2), T, SPACE(2)) AS T12;
	MAX(IIF(BETWEEN(date, ldStartP2, ldEndP2), U, SPACE(2)) AS U12;
	WHERE date BETWEEN ldStartP1 AND ldEndP2 ;
	GROUP BY 1,2 ;
        ORDER BY 1,2 ;
	INTO CURSOR crsResult
>i have this sample data,
>
>
>empno date        A     T     U
>00001 11/01/2003  S
>00001 11/02/2003        10
>00001 11/03/2003  F
>00001 11/04/2003
>00001 11/05/2003
>.
>00002 11/30/2003
>00002 12/01/2003  S
>00002 12/02/2003
>00002 12/03/2003
>00002 12/04/2003
>00002 12/05/2003
>.
>00002 12/31/2003
>
>
>how can i select all these records so that i can have this,
>
>
>            nov       dec
>empno day A  T  U   A  T  U
>00001  1  S              45
>00001  2    10
>00001  3  F
>00001  4
>00001  5
>.
>
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform