Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sql filter
Message
 
 
To
29/04/2011 11:20:27
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01508827
Message ID:
01508830
Views:
58
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform