SQL WHERE datetime > NOW

From: Date: Sun, 04 Jan 2004 01:05:29 +0000
Subject: SQL WHERE datetime > NOW
Groups: php.db 
Request: Send a blank email to php-db+get-32259@lists.php.net to get a copy of this message
Thanks for that. In fact, it was something else wrong and it does work. However, I do have another problem on this. The query is: ...WHERE TO_DAYS(NOW())+1>TO_DAYS(MyTable.MyField) ORDER BY MyTable.MyField DESC LIMIT 30"; however, the LIMIT seems to apply before the ORDER BY clause. How can I get the LIMIT to apply after the ORDER BY? Thanks, John "Neil Smth" <php@comatose.freeserve.co.uk> wrote in message news:5.2.0.9.0.20040103213245.00a7d058@pop.freeserve.net... > Presumably where you are generating TO_DAYS(NOW()) you meant to say > TO_DAYS(NOW())+1 ? (which is days *after* today !) > > Also, you did not specify how it "does not work" - can you be mroe > descriptive, what error message did you receive, how many rows did you > expect and get out ? > > Cheers - Neil. > > At 19:29 03/01/2004 +0000, you wrote: > >Message-ID: <001201c3d1f5$065c70a0$391c8051@johnc91qo3hbzu> > >From: "John Dillon" <ioannes@btinternet.com> > >To: <php-db@lists.php.net> > >Date: Sat, 3 Jan 2004 12:27:58 -0000 > >MIME-Version: 1.0 > >Content-Type: text/plain; > > charset="iso-8859-1" > >Content-Transfer-Encoding: 7bit > >Subject: > > > >I'm trying to limit the results where a datatime field is later than > >todays date: > > > >WHERE TO_DAYS(NOW())>TO_DAYS(MyTable.myfield) > > > >doesn't appear to work. Should it? Should I not be nesting functions > >within an SQL statement like > >this? > > > >Thanks in advance for any ideas. > > > >John

« previous php.db (#32259) next »