A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
Arduino in Action
this week in the
General Computing
forum!
A special promo:
Enter your blog post or vote on a blogger to be featured in an upcoming Journal
JavaRanch
»
Java Forums
»
Databases
»
JDBC
Author
Date Comparison in MySQL Columns
Aravind Prasad
Ranch Hand
Joined: Dec 28, 2005
Posts: 258
posted
Feb 15, 2007 07:07:00
0
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
table name : test ---------------------------------- id | date_in | actual_date | ---------------------------------- 001 | 01-01-2006 | 01-01-2006 | 002 | 02-01-2006 | 02-01-2006 | 003 | 03-01-2006 | 01-01-2006 | 004 | 04-01-2006 | 07-01-2006 | 005 | 05-01-2006 | 07-01-2006 | 006 | 06-01-2006 | 07-01-2006 | 007 | 07-01-2006 | 07-01-2006 | 008 | 08-01-2006 | 01-01-2006 | 009 | 09-01-2006 | 09-01-2006 | ----------------------------------
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..
regards
Aravind Prasad
Jan Cumps
Bartender
Joined: Dec 20, 2006
Posts: 2350
I like...
posted
Feb 15, 2007 16:24:00
0
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
ITIL foundation
I agree. Here's the link:
http://zeroturnaround.com/jrebel
- it saves me about five hours per week
subject: Date Comparison in MySQL Columns
Similar Threads
Populating Database values in to JTable
can you do that in one query?
Problem with trying to Insert values into User
Query problem with MySQL 5
retrieving date field from access database using query
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter