wood burning stoves 2.0*
The moose likes JDBC and the fly likes how to compare sql date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to compare sql date" Watch "how to compare sql date" New topic
Author

how to compare sql date

arvind kushwaha
Ranch Hand

Joined: Aug 12, 2011
Posts: 32
Dear Team,

I have one table...in which data is stored along with date and time...i want to retrieve the data based on current date..

But as in table data is stored with date time...I am unable to retrieve it...Please help me out ...ITs urgent!!!


i am writing query....Select * from securities where updatedfields='curdate()' but in updated fields data is stored like 2011-8-18 10:55:14 in this format i want to retrieve the data based on date.
Sudheer Bhat
Ranch Hand

Joined: Feb 22, 2011
Posts: 75
If you want to select those rows which are updated today, then why don't you use "updatedfields = sysdate"? I assume that the datatype of updatedfields is DATE.


arvind kushwaha
Ranch Hand

Joined: Aug 12, 2011
Posts: 32
dear team,,


the datatype for updatedfields is datetime...so that why its not working..
Sudheer Bhat
Ranch Hand

Joined: Feb 22, 2011
Posts: 75
I am no expert in MYSQL ( I think your DB is MYSQL since Oracle doesn't have a DATETIME datatype), this is what I came up after referring to mySQL manual.


Where test is a table and it has test column of datatype datetime.
arvind kushwaha
Ranch Hand

Joined: Aug 12, 2011
Posts: 32
Thanks sudhir...It working now....Thanks you so much.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to compare sql date
 
Similar Threads
Possible reasons?
Transaction Isolation
Necessity to override both equals() and override() methods
Working with multiple database Tables
get time information from oracle DATE field