Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Left Outer Join, group by, and date-based queries
bbcrock_at_gmail.com wrote:
> Thanks, but none of the examples address doing a fake outer join on a
> month. My half-assed result is:
>
> select Months.dt, count(t2.month) total
> from ( select to_char(to_date(level,'MM'),'YYYY Mon') AS dt from
> dual connect by level <= 12 ) Months,
> (select to_char(trunc(user_date, 'MM'), 'YYYY Mon') Month
> from userlog
> where event = 'LOGIN'
> ) t2
> where Months.dt = t2.month (+)
> group by rollup( Months.dt )
>
> however, I need to do this for month and year together, in other words,
> the above query filters out data only by month- not month/year. If
> anyone can point me in the right direction, that would be cool. my
> brain hurts.
>
>
> Don
What is the data type of level?
What version of Oracle?
You might want to stop using key words for column names and aliases.
Take a good look at v$reserved_words in your data dictionary.
-- Daniel A. Morgan http://www.psoug.org damorgan_at_x.washington.edu (replace x with u to respond)Received on Mon Nov 28 2005 - 14:16:55 CST