Meaningless Drivel is fun!
The moose likes JDBC and Relational Databases and the fly likes Date Comparison in MySQL Columns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Date Comparison in MySQL Columns" Watch "Date Comparison in MySQL Columns" New topic

Date Comparison in MySQL Columns

Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 265
Dear Ranchers,
I'm doing JSP and MySQL in my project and and i've a doubt in the query.
The table details are given below

I want to write a query to compare the 2 colums , date_in and actual_date and for example

Select * from test where date_in > actual_date
So that it can bring some results which are early delivery's

Please help me ranchers for my query.

Thanks in advance..

Aravind Prasad
Jan Cumps

Joined: Dec 20, 2006
Posts: 2565

Select * from test where date_in > actual_date

This query looks fine to me.
If date_in is the expected date, and actual_date is the delivery date, then this query will return early deliveries.
(at least, when these columns are defined as date fields in MySQL).

Regards, Jan

OCUP UML fundamental and ITIL foundation
I agree. Here's the link:
subject: Date Comparison in MySQL Columns
It's not a secret anymore!