Home » SQL & PL/SQL » SQL & PL/SQL » display all dates between two dates (Oracle 10g)
display all dates between two dates [message #348718] Wed, 17 September 2008 15:19 Go to next message
justbegginer
Messages: 3
Registered: September 2008
Junior Member
Hi all, i am new to this forum. Hope everyone doing great!

I am trying to write a query that display all the months available between two dates.

Lets say i have service table. That has fields like Service_start_date and service_end_date.

When i do service_start_date - service_end_date, i want to get all the dates between two dates.


Can anyone help me on this?



THanks in advance
Re: display all dates between two dates [message #348719 is a reply to message #348718] Wed, 17 September 2008 15:20 Go to previous messageGo to next message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/t/88153/0/
Please read & follow posting guidelines as stated in URL above

search this forum for "calendar"
Re: display all dates between two dates [message #348730 is a reply to message #348719] Wed, 17 September 2008 16:12 Go to previous messageGo to next message
justbegginer
Messages: 3
Registered: September 2008
Junior Member
Hi all, i treid to get the months with montly sal

This query gave me all month numbers

select distinct t.f_month_number
from time_dim t
where
f_date between (select start_date from employee where emp_id = 111 ) and
(select add_months(start_Date,12) from employee where emp_id = 111)[b]


but when i add the sal value...

select distinct t.f_month_number,p.start_date,round(replace(p.total_sal,',','')/12,2) as Monthly_sal
from time_dim t, employee p
where
t.f_date = p.start_date and
f_date between (select start_date from employee where emp_id = 111 ) and
(select add_months(start_Date,12) from employee where emp_id = 111)


i got only one month value. How do i resolve this issue.

Re: display all dates between two dates [message #348779 is a reply to message #348730] Wed, 17 September 2008 23:17 Go to previous messageGo to next message
rajatratewal
Messages: 507
Registered: March 2008
Location: INDIA
Senior Member
Post A Test Case.

Regards,
Rajat
Re: display all dates between two dates [message #348819 is a reply to message #348730] Thu, 18 September 2008 00:36 Go to previous message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Also please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter).
Use the "Preview Message" button to verify.
And always post your Oracle version with 4 decimals.

Regards
Michel
Previous Topic: how can i change/update the length of a datatype
Next Topic: Bulk Update
Goto Forum:
  


Current Time: Fri Dec 02 14:20:38 CST 2016

Total time taken to generate the page: 0.24996 seconds