Re: Query w/Group By
Date: Thu, 28 Feb 2008 09:56:13 +0100
<amerar_at_iwc.net> schreef in bericht
> 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