I'm trying to place data into a date range from a dual query. The outcome should look like this:
SINGLEDAY FLAG
01-NOV-2016 1
02-NOV-2016 -
03-NOV-2016 -
04-NOV-2016 1
05-NOV-2016 -
For the list of days I'm using
select (to_date('11.2016','mm.yyyy')+level-1) as SINGLEDAY
from dual
connect by level <= TO_CHAR(LAST_DAY(to_date('11.2016','mm.yyyy')),'DD')
But how do I join content of my table xyz with the outcome? table xyz should be connected by a DATE_OF_SERVICE (date)column. Any help would be highly appreciated.
This is basically a
left join
on your query. Assuming at most one row in your table for each date:If there are multiples, then perhaps you what
group by
: