SELECT * FROM <table> WHERE date LIKE '2005-01-07%';

David Logan
Database Administrator
HP Managed Services
148 Frome Street,
Adelaide 5000
Australia

+61 8 8408 4273 - Work
+61 417 268 665 - Mobile
+61 8 8408 4259 - Fax


-----Original Message-----
From: Pete Moran [mailto:[EMAIL PROTECTED] 
Sent: Monday, 21 March 2005 10:46 AM
To: mysql@lists.mysql.com
Subject: DateTime Select optimised

Hi All,

 

Is there a simpler way of doing a select for a given date, for instance
if I
have a datetime field called date

 

And so its populated with a load of values such as 

 

2005-01-07 09:00

2005-01-07 10:00

2005-01-07 11:00

2005-01-07 12:00

 

If I wanted all records which fall on 2005-01-07 I could of course do 

 

Select * from <TABLE> where date > '2005-01-07' and date <
DATE_ADD('2005-01-07', INTERVAL 24 HOUR)

 

However is there a simpler way of doing it by just passing one date like

 

Select * from <TABLE> where date = '2005-01-07'

 

?

 


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.4 - Release Date: 18/03/2005



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.4 - Release Date: 18/03/2005
 

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

Reply via email to