Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Mysql querry

0 views
Skip to first unread message

Sebastian

unread,
Jun 1, 2007, 9:46:04 AM6/1/07
to
Hi

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

Paul Lautman

unread,
Jun 1, 2007, 9:55:01 AM6/1/07
to

Because now plus 20 days is 20 days from now!

E.g. now is Friday. Now plus 2 days is Sunday.

Get the idea?


Sebastian

unread,
Jun 1, 2007, 11:39:48 AM6/1/07
to

> 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

lark

unread,
Jun 1, 2007, 12:54:44 PM6/1/07
to
== Quote from Sebastian (haja.se...@gmail.com)'s article

i just tried this on a timestamp field and it didn't work either.
--
POST BY: lark with PHP News Reader

Paul Lautman

unread,
Jun 2, 2007, 6:10:31 PM6/2/07
to

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.


0 new messages