Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sql clause
Message
 
À
24/12/2005 07:10:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01080241
Message ID:
01080694
Vues:
14
Gregory,

sorry for my poor english but my parents wanted that I study Hollands in place of English ...:)

Please try this code , and see the ( bad ) result For iresidentid = 2

Please help me , c'est noel et je dois m'occupper des enfants ....:)

bernhart
CREATE CURSOR Etats (dDebut D, dFin D , iresidentid i , iid i )


  *-- je veux touver toutes les dates comprises entre le {^2005/01/08}
  *-- et le {^2005/06/25} pour le resident 1753
  
  INSERT INTO Etats VALUES ({^2005/01/08}, {^2005/03/30} , 1753 , 1 )
  INSERT INTO Etats VALUES ({^2005/04/10}, {^2005/06/25} , 1753 , 2 )
  INSERT INTO Etats VALUES ({^2005/01/10}, {^2005/06/25} , 1754 , 3 )
  INSERT INTO Etats VALUES ({^2006/01/10}, {^2007/05/25} , 1756 , 4 )
  INSERT INTO Etats VALUES ({^2006/05/30}, {^2007/06/25} , 1756 , 5 )
 INSERT INTO Etats VALUES ({^2001/01/08}, {^2003/03/30} , 2 , 6 )

  && (1)
  && min and max dates:  entre le {^2005/01/08} et le {^2005/06/25} pour chaque resident
  SELECT MIN(dDebut)	AS	MinDate, ;
    MAX(dFin)	AS	Maxdate ;
    FROM Etats ;
    INTO CURSOR MinMax

  && (2)
  SELECT DISTINCT iresidentid ;
    FROM Etats ;
    INTO CURSOR Resident ;

  && (3)
  SELECT Resident.iresidentid, ;
    dDate, ;
    dDebut ;
    FROM Resident ;
    JOIN dDate ;
    ON ( dDate BETWEEN MinMax.MinDate AND MinMax.Maxdate ) ;
    LEFT JOIN Etats ON ;
    (	(Resident.iresidentid = Etats.iresidentid) ;
    AND	;
    ( dDate BETWEEN dDebut  AND dFin ) ;
    ) ;
    INTO CURSOR tmp ;
    HAVING ( dDebut IS NULL )
SET
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform