Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using trunc as difference measure btwn two dates

robleh7Jul 25 2013 — edited Jul 26 2013

I have a SQL query that works smoothly. It takes the difference between sets of dates that are >=0 and <=0. here it is:

SELECT createdate,  id, objid, start_date, end_date

FROM greggs_date, HNEMap

where active =1

and trunc (createdate-start_date) >=0  and trunc (createdate-end_date) <=0;

Problem is I can't output the differences. In MS SQL Server you can show the number of days difference with the datediff function named in the SELECT part of the SQL statement not so with trunc used to get date differences. How can this query be rework to show the actual days of difference between start and end from create date.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 23 2013
Added on Jul 25 2013
16 comments
4,214 views