Re: Query w/Group By

From: shakespeare <whatsin_at_xs4all.nl>
Date: Thu, 28 Feb 2008 09:56:13 +0100
Message-ID: <47c67734$1$14359$e4fe514c@news.xs4all.nl>

<amerar_at_iwc.net> schreef in bericht
news:6677eb82-af85-4b0b-8f4e-a713b0ff7af4_at_d62g2000hsf.googlegroups.com...
>
> Who do management people always want it complex?
>
> I need to run this query grouping by user Id and month:
>
> SELECT userid||','||count(*)||','||sum(tranamt_n)
> FROM ej1
> WHERE effctvdate>=to_date('01/01/2007','mm/dd/yyyy')
> and corrstat=' ' and tranamt_n>0
> and officename='Linebarger'
> group by userid, TO_CHAR(SYSDATE,'MM');
>
> I have yet to figure this one out........
>
>

Why 'group by to_char(sysdate,'MM')' ?? Wouldn't that return the same value for all records? (02)
I think what you would want is an expression on effctvdate.

Shakespeare Received on Thu Feb 28 2008 - 02:56:13 CST

Original text of this message