Re: SQL, Group by expressions
Date: Fri, 18 Sep 1998 14:02:54 GMT
Message-ID: <360266ff.30301171_at_news.siol.net>
On Fri, 18 Sep 1998 14:22:03 +0200, Emmanuel Baechler <ebaechle_at_hospvd.ch> wrote:
>Hi,
>
>I did recently notice a behavior that looks rather strange to me:
>
>Recently, I got an error when I tried to execute the following
>request, that looked correct to me:
>
>select TO_CHAR(T.date,'YYYY') As YEAR,
> TO_CHAR(T.date,'MM') As MONTH,
> A.DESCR,
> COUNT (*),
>from Details D,
> Articles A,
> Transactions T
>where D.No_Article =A.No and
> D.No_transact=T.No and
> -- A few more criteria for filtering
>group by Year, Month, A.Descr;
>
>The error message was:
>
>ORA-00904: invalid colum name
>the substring: 'Month, A.Descr' was highlighted
Change your GROUP BY clouse to:
...GR0UP BY TO_CHAR(T.date,'YYYY'),
TO_CHAR(T.date,'MM'), A.DESCR;
and query will execute without errors.
HTH,
-- Jurij Modic <jmodic_at_src.si> Certified Oracle7 DBA (OCP) ================================================ The above opinions are mine and do not represent any official standpoints of my employerReceived on Fri Sep 18 1998 - 16:02:54 CEST