Forum Moderators: open

Message Too Old, No Replies

MySQL query help

         

artie2004

3:53 am on Sep 20, 2006 (gmt 0)

10+ Year Member



Hi. First, how do i query all records for the current date? Second, how do i query all records from the previous day?

i.e. this is my table

table clients (
name char(25),
cid char(8),
email char(25),
tel char(10),
date datetime
);

Thanks.

coopster

10:05 pm on Sep 20, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



SELECT * FROM clients WHERE `date` = CURRENT_DATE; 
SELECT * FROM clients WHERE `date` = CURRENT_DATE - INTERVAL 1 DAY;

Side note:
If at all possible you shouldn't name a column the same as a reserved word (in this case your
date
column).

artie2004

1:26 am on Sep 21, 2006 (gmt 0)

10+ Year Member



thanks coopster.