Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Left Outer Join, group by, and date-based queries

Re: Left Outer Join, group by, and date-based queries

From: DA Morgan <damorgan_at_psoug.org>
Date: Mon, 28 Nov 2005 12:16:55 -0800
Message-ID: <1133209009.152879@yasure>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US