Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sql filter
Message
 
 
À
29/04/2011 11:20:27
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01508827
Message ID:
01508830
Vues:
59
>I am creating a query and I want to filter records where the status is (released or completed) and the date is greater than 01/01/2006.
>
>It ignores the date filter. I have tried variations of ( x or y) and (z) parenthesis with no luck?
>
>fstatus is a character field
>fopen_dt is a date field
>
>the status filter works fine, but the date does not.
>
>
SELECT Jomast.fjobno, Jomast.fpartno, Jomast.fsono, Jomast.fstatus,;
>  Jopact.fjobno, Jopact.flabact, Jopact.fmatlact, Jopact.fovhdact,;
>  Jomast.fopen_dt;
> FROM ;
>     M2MDATA!JOMAST ;
>    INNER JOIN M2MDATA!JOPACT ;
>   ON  Jomast.fjobno = Jopact.fjobno;
> WHERE  Jomast.fstatus = ( "RELEASED" );
>   OR   Jomast.fstatus = ( "COMPLETED" );
>   AND  Jomast.fopen_dt > ctod("01/01/2006") ;
> ORDER BY Jomast.fpartno
Try using IN operator instead, e.g.
SELECT Jomast.fjobno, Jomast.fpartno, Jomast.fsono, Jomast.fstatus,;
  Jopact.fjobno, Jopact.flabact, Jopact.fmatlact, Jopact.fovhdact,;
  Jomast.fopen_dt;
 FROM ;
     M2MDATA!JOMAST ;
    INNER JOIN M2MDATA!JOPACT ;
   ON  Jomast.fjobno = Jopact.fjobno;
 WHERE  Jomast.fstatus IN ( 'RELEASED' , 'COMPLETED' );
   AND  Jomast.fopen_dt > ctod("01/01/2006") ;
 ORDER BY Jomast.fpartno
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform