Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 how to compare a date in mysql 5.0

Author  Topic 

arvindbkushwaha
Starting Member

2 Posts

Posted - 2011-08-22 : 02:40:44
I have a table with lastupdated column where data is stored with date and time ..I want to retrieve the data based on date only..but database contain time also..I cannot modify the column..How should i write a sql query to retrieve the data based on date only not with time if database contain data along with time..

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-22 : 02:45:59
In sql server it will be something like


WHERE lastupdated >= <your date value without time>
AND lastupdated < <your date value without time> + 1

Not much sure on mysql. this is a sql server forum and solutions given here are mostly sql server specific. In case above doent work please try you luck in some mysql forums like
http://www.dbforums.com/mysql/

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

arvindbkushwaha
Starting Member

2 Posts

Posted - 2011-08-22 : 03:47:57
can u provide some query example in details..
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-22 : 04:30:47
for example if you want all records from table which got updated today the query should be like

SELECT columns...
FROM table
WHERE lastupdated >= '20110822'
AND lastupdated < '20110823'



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -