[SOLVED] Using STRCMP in a query
Posted: Wed Feb 07, 2007 10:40 am
I am using the following query, MySQL 4.1.10:
AptDate is a "date" field (not date-time), JobStat is a tinyint.
The query returns records with AptDate of 2007-02-07 regardless of value of JobStat.
There is a record, however, with a AptDate of 2007-02-06 and a JobStat=0 that this query is not returning.
What am I doing wrong?
Code: Select all
SELECT * FROM Tickets WHERE idTech=4 AND (AptDate='2007-02-07' OR (JobStat=0 AND STRCMP('AptDate','2007-02-07')<0)) ORDER BY AptDate,AptTimeThe query returns records with AptDate of 2007-02-07 regardless of value of JobStat.
There is a record, however, with a AptDate of 2007-02-06 and a JobStat=0 that this query is not returning.
What am I doing wrong?