Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Difference between two dates
Hi,
Are the dates stored at text or as dates in the database? If they are
stored as text you will need to perform a conversion from the text to date
as:
SELECT TO_DATE(finish_date, 'DD-MON-RR') -
TO_DATE(start_date, 'DD-MON-RR') "Days Between"FROM cust_table;
If the columns are actual date the columns then simply:
SELECT finish_date - start_date "Days Between" FROM cust_table;
Brian
likw wrote in message <000b8d9b.76608b41_at_usw-ex0107-049.remarq.com>...
>Customer_name; Start_Date; Finish_Date
>--------------------------------------
>ABC; 02-Nov-99; 10-Nov-99
>CDE; 12-Nov-99; 15-Nov-99
>GHI; 18-Dec-99; 25-Jan-00
>
>Could you help to get the difference between two Dates??
>
>I wish to have the result like below
>Customer_name; Days difference (Finish date - Start date) for each
>customer.
>
>Can you help?? I don't know how to do subtraction in SQL (Oracle).
>
>
>
>* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network
*
>The fastest and easiest way to search and participate in Usenet - Free!
>
Received on Sun Nov 07 1999 - 07:49:31 CST
![]() |
![]() |