Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT count(id),created FROM event
- WHERE created > now() - interval 1 day
- AND type = 'name_of_action'
- AND user = 'username'
- union
- SELECT count(id),created FROM event
- WHERE created > now() - interval 2 day and interval 1 day
- AND action = 'name_of_action'
- AND user = 'username'
- /*
- Trying to have a query that will go and give me the count of unique id's that have a certain action against them. But the kicker is that I want it to give me the count by each day. not by each 24 hour interval from the moment I run it but what the count is for the actual calendar date.
- Ex. If i run the query at 8 am on 2012-02-08 i should only have the unique count for the last 8 hours, not all the way back to 8 am on 2012-02-07
- */
Add Comment
Please, Sign In to add comment