Ok. I found something. But wondering if this is most
efficient
Events for yesterday:
select count(*) from EVENT_DATA where
FROM_UNIXTIME(utime,'%Y-%m-%d') = (CURDATE() -
INTERVAL 1 DAY);

Events for last week
select count(*) from EVENT_DATA where
FROM_UNIXTIME(utime,'%U') =
(DATE_FORMAT(CURDATE(),'%v')-1);

TIA
Ravi
--- Ravi Malghan <[EMAIL PROTECTED]> wrote:

> Hi: I have a date/time field (utime) which has unix
> time in epoch time. I want to select events from
> yesterday and another statement for all events from
> previous week.
> 
> I have tried the functions listed at
>
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html.
> But I either get a syntax error or just the wrong
> info.
> 
> select * from TABLE where utime < endtime and utime
> >
> starttime
> 
> how do I get the starttime and endtime for yesterday
> and also the last week(Sunday to Saturday)?
> 
> Thanks
> Ravi
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:   
>
http://lists.mysql.com/[EMAIL PROTECTED]
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to