sql - Using the next_day to retrieve the previous day and the following day -
i have sql code. trying retrieve previous monday , next sunday using next_day function. how make query work? using oracle sql developer run query.
this data want show:
fullname, monday sunday john brown 31-dec-2012 06-jan-2013
here code have far:
select first_name, last_name, dob, add_months(dob, (extract(year sysdate)- extract(year dob))*12) birthdatethisyear customers
i tried adding these statements, got error after runninng query:
next_day(birthdatethisyear-8, 'mon') previousmonday next_day((birthdatethisyear-8)+6, 'mon') upcomingsunday
i can try this:
select first_name || ' ' || last_name fullname, next_day(birthdatethisyear-8, 'monday') previousmonday, next_day(birthdatethisyear-1, 'sunday') upcomingsunday (select first_name, last_name, dob, add_months(dob, (extract(year sysdate)- extract(year dob))*12) birthdatethisyear customers)
Comments
Post a Comment