How can I write a MySQL query that returns true/false (1/0 actually) based upon the value of a column.
In my instance I want to return “hasDate” for a date time col, let’s call it myDateTime
if myDateTime has a value of 000-00-00 00:00:00 I want to return hasDate of 0 (false)
If myDateTime has any other value I want to return hasDate of 1 (true)
Thanks for your assistance.
Use a
IFstatementBut the best idea would be to change your data structure to avoid doing that.