Forums

Where statement

freewheelers 16 Apr, 2013
Hi All,

Could someone just correct this peice of MySQL for me please, I've tried all sorts of combinations!
I and get each part to work atand alone, but not both together😟

select_0='WX62VYB R1200RT (5)' and cf_created BETWEEN CURDATE() - INTERVAL 14 DAY AND NOW()


Regards
Andrew
GreyHead 16 Apr, 2013
Hi Andrew,

I think it is
`select_0` = 'WX62VYB R1200RT (5)' 
AND `cf_created` BETWEEN DATE_SUB(CURDATE(), INTERVAL 14 DAY) AND CURDATE()
or, as the created date can't be later than today.
`select_0` = 'WX62VYB R1200RT (5)' 
AND `cf_created` > DATE_SUB(CURDATE(), INTERVAL 14 DAY)

Bob
freewheelers 16 Apr, 2013
Couldn't get it to work for a while, then I noticed there were no entries in the table with a date within the last 14 days! But 30 works a treat.

I am using your example code now, thank-you.

Andrew
This topic is locked and no more replies can be posted.