southbeach
Programmer
I have this query
the query is dynamically built, hence the WHERE 1 and the potential AND clauses.
I need help with the ( `Expires` >= "2016/07/29" OR `Expires` = "" ) part of the query. I have an additional field "status". The expiry date only applies to status "Q" and for the life of me, I cannot get it to work.
I have changed it to:
but this only selects rows with status Q, which made it even worst.
I am starting to think that I may have to do a SELECT * FROM (SELECT ...) type of query but hate the possible speed compromise.
Suggestions please!
Thank you all for your assistance.
--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
Code:
SELECT * FROM `pvt05e01adaily` WHERE 1
AND ( `Expires` >= "2016/07/29" OR `Expires` = "" )
AND ...
AND ...
AND ...
ORDER BY `ID` DESC LIMIT 0, 300
the query is dynamically built, hence the WHERE 1 and the potential AND clauses.
I need help with the ( `Expires` >= "2016/07/29" OR `Expires` = "" ) part of the query. I have an additional field "status". The expiry date only applies to status "Q" and for the life of me, I cannot get it to work.
I have changed it to:
Code:
( WHEN `status` = "Q" THEN `Expires` >= "2016/07/29" OR `Expires` = "" END )
I am starting to think that I may have to do a SELECT * FROM (SELECT ...) type of query but hate the possible speed compromise.
Suggestions please!
Thank you all for your assistance.
--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.