Home » SQL & PL/SQL » SQL & PL/SQL » Please help Try to COUNT - beginner *URGENT*
Please help Try to COUNT - beginner *URGENT* [message #7364] Sun, 08 June 2003 10:34 Go to next message
Angela
Messages: 13
Registered: October 2000
Junior Member
Hello,
Im trying to count the total of salesperson per region
and also join the 2 tables I have. Im using SQL plus 8.0. Here are my tables:

Salesperson table:
Salesperson_ID Salesperson_Region_ID
aaa E1
bbb E1
ccc W2
ddd W2
fff S4

Salesperson_Region Table:
Salesperson_Region_ID Salesperson_Region_Descrip
E1 East
W2 West
S4 South

Here is my statement
SELECT S.SALESPERSON_REGION_ID, COUNT(S.SALESPERSON_REGION_ID),
SALESPERSON_REGION_DESCRIP
FROM SALESPERSON AS S, SALESPERSON_REGION AS SR
WHERE S.SALESPERSON_REGION_ID = SR.SALESPERSON_REGION_ID
GROUP BY S.SALESPERSON_REGION_ID;

ERROR message:
SELECT S.SALESPERSON_REGION_ID, COUNT(S.SALESPERSON_REGION_ID),
*
ERROR at line 1:
OCA-30021: error preparing/executing SQL statement
[[POL-5235]] not a GROUP BY expression

I thought I did everything right. =( Thanx
Nevermind, I got it [message #7365 is a reply to message #7364] Sun, 08 June 2003 16:55 Go to previous messageGo to next message
Angela
Messages: 13
Registered: October 2000
Junior Member
I got it,

--
---
GROUP BY S.SALESPERSON_REGION_ID, SALESPERSON_REGION_DESCRIP;

Duuhh !!!!
=p
Re: Please help Try to COUNT - beginner *URGENT* [message #7456 is a reply to message #7364] Mon, 16 June 2003 01:25 Go to previous message
suneesh
Messages: 1
Registered: June 2003
Junior Member
SELECT S.SALESPERSON_REGION_ID, COUNT(S.SALESPERSON_REGION_ID
FROM SALESPERSON AS S, SALESPERSON_REGION AS SR
WHERE S.SALESPERSON_REGION_ID = SR.SALESPERSON_REGION_ID
GROUP BY S.SALESPERSON_REGION_ID
Previous Topic: isolation levels
Next Topic: Deleting duplicate records
Goto Forum:
  


Current Time: Tue May 07 06:35:35 CDT 2024