Re: Newbie SQL Question

From: Vic Smyth <vicsmyth_at_megsinet.net>
Date: Tue, 30 Mar 1999 22:30:01 -0800
Message-ID: <3701C0E9.92D_at_megsinet.net>


It worked, thank-you!

Vic

To reply to email remove the "myth" from the address.

Archana Rajagopal wrote:
>
> Hi Vic,
> Check the syntax of GROUP BY clause...
> All columns in SELECT clause must be used in the GROUP BY clause that are
> NOT part of the vector function.
>
> Think about it... This is required as for a value of CUS_CODE in your
> example, if multiple values of CUS_BALANCE exist the GROUPING cannot be
> performed legally !!
>
> This is the reason when you remove CUS_BALANCE from the SELECt aclause the
> QUERY works...
>
> Try adding CUS_BALANCE to the GROUP BY clause... Semantically this may or
> may NOT be meaningful....
>
> Hope this helps..
>
> Archana R.
>
> Vic Smyth wrote in message <37000FFE.1084_at_megsinet.net>...
> >I'm doing a project for school using sqlplus (command-line sql for Oracle).
> I
> >keep getting the following error message when I try to do a GROUP BY. Other
> >commands I have no problem with. If I take out CUSTOMER.CUS_BALANCE on line
> 1
> >the command executes and I get everything except the column I deleted. My
> >text and the help screen in Oracle are not much help. What am I doing
> wrong?
> >
> >Thanks in advance!
> >
> >Vic
> >
> >To reply to email remove the "myth" from the address.
> >
> >SQL> SELECT CUSTOMER.CUS_CODE, CUSTOMER.CUS_BALANCE,
> > 2 SUM(LINE.LINE_UNITS * LINE.LINE_PRICE)
> > 3 FROM CUSTOMER, INVOICE, LINE
> > 4 WHERE CUSTOMER.CUS_CODE = INVOICE.CUS_CODE
> > 5 AND LINE.INV_NUMBER = INVOICE.INV_NUMBER
> > 6 GROUP BY CUSTOMER.CUS_CODE;
> >SELECT CUSTOMER.CUS_CODE, CUSTOMER.CUS_BALANCE,
> > *
> >ERROR at line 1:
> >ORA-00979: not a GROUP BY expression
Received on Wed Mar 31 1999 - 08:30:01 CEST

Original text of this message