[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

(OT ?) SQL doubt



Dear members ,
        I am  trying to brush up my SQL (Oracle) , and before I dust my books , I
decided to take an assignment :-

Q) Get all the suppliers and the total number of parts they are supplying.

table      s :-
s# not null varchar2(3)
s_name     varchar2(7)
status        number
city           varchar2(6)


table     sp :-
s#   not null varchar2(3)
p#  not null varchar2(3)
qty  number


s# means supplier's ID and p# means product ID


This is what I tried : - select count(p#) from s,sp where s.s#=sp.s# group by sp.s#

But when I tried select sname,count(p#) from s,sp where s.s#=sp.s# group by  sp.s# ,
I am shown an error that says something like : " Single-group .... "

Please help me.

Thanks in advance,
(shyamk@eth.net)
Shyam




Reply to: