I have a problem with mysql querry
SELECT * FROM viewfor_prop_for_search WHERE createdon BETWEEN NOW()
AND NOW() +
INTERVAL 20 day;
i try get rows added in last 20 days.
creadon is datetime type
Why it doesn't work
Sebastian
Because now plus 20 days is 20 days from now!
E.g. now is Friday. Now plus 2 days is Sunday.
Get the idea?
Hehe, i make mestake, but with minus is doesn't work to
i just tried this on a timestamp field and it didn't work either.
--
POST BY: lark with PHP News Reader
Well I don't know why lark couldn't get it to work but I just tried:
SELECT * FROM `viewfor_prop_for_search` WHERE `createdon` BETWEEN NOW() -
INTERVAL 20 DAY AND NOW();
and it worked fine.
Could you post an extract from your table (the create statement and some
inserts) and your query so I can see what's wrong.