List:General Discussion« Previous MessageNext Message »
From:Andrey Dmitriev Date:April 13 2007 10:41pm
Subject:RE: how to tell if something hasn't happened yet
View as plain text  
It depends on what's in the datetime column.

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

Something like this:

select store.storeid, store.stName
from store left outer join transaction
on(store.storeid = transaction.storeid) 
where transaction.created IS NULL 
and store.active = 'yes'
and date(transaction.created)=date(curdate())
group by store.storeid; 

-----Original Message-----
From: Jay Blanchard [mailto:jblanchard@stripped] 
Sent: Friday, April 13, 2007 6:22 PM
To: mysql@stripped
Subject: how to tell if something hasn't happened yet

Good day gurus and gurettes!

I have a table;

| transactionid | int(11)     | NO   | PRI |         | auto_increment |
| username      | varchar(32) | NO   |     |         |                |
| storeid       | varchar(6)  | NO   |     |         |                |
| action        | int(4)      | NO   |     |         |                |
| code          | int(2)      | NO   |     |         |                |
| ipAddr        | varchar(32) | NO   |     |         |                |
| created       | datetime    | NO   | MUL |         |                |
| created_by    | varchar(32) | NO   |     |         |                |

I used to have a query (I have misplaced it somehow) where I could tell 
which storied had not logged in (created) today yet. No matter how hard 
I try I cannot remember the query.

What I need is a query that will tell me at any given point during the 
day which storeid is not online (created). I do have a sister table 
where all of the storeid's are, so the join happens there. I can test 
created for IS NULL but it does not limit the query to today.

select store.storeid, store.stName
from store left outer join transaction
on(store.storeid = transaction.storeid) where transaction.created IS 
NULL and store.active = 'yes'
group by store.storeid;

How can I limit this to today only without having to hard code a date 
into the query?

TVMIA!

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    
http://lists.mysql.com/mysql?unsub=1



Thread
how to tell if something hasn't happened yetJay Blanchard14 Apr
  • RE: how to tell if something hasn't happened yetAndrey Dmitriev14 Apr
Re: how to tell if something hasn't happened yetMogens Melander14 Apr
  • RE: how to tell if something hasn't happened yetJay Blanchard16 Apr
    • RE: how to tell if something hasn't happened yet - SOLVEDJay Blanchard16 Apr
RE: how to tell if something hasn't happened yetMogens Melander17 Apr
  • RE: how to tell if something hasn't happened yetMogens Melander17 Apr