Home » SQL & PL/SQL » SQL & PL/SQL » complex query please help
complex query please help [message #21586] Thu, 15 August 2002 21:41 Go to next message
Anuj
Messages: 9
Registered: August 2002
Junior Member
table Test with id, region,amount
data

id region amount
1 a 0
2 a 0
3 a 199
4 b 0
5 b 0
6 b 0
7 b 56
. . .
. . .
. . .
. . .

how to write a query to display??

region countids countidswithnoamount (amount =0)
a 3 2
b 4 3
. . .
. . .
. . .
. . .

I'd really appreciate the feedback or pointers thanks.
Re: complex query please help [message #21639 is a reply to message #21586] Tue, 20 August 2002 21:50 Go to previous message
Deepa
Messages: 269
Registered: November 2000
Senior Member
hi,
hope the following query solves u'r problem.
select region,count(*),sum(decode(amount,0,1,0)) from test
group by region;
Previous Topic: CLOB and PLSQL FUNCTION
Next Topic: NB# ORA-03113: end-of-file on communication channel
Goto Forum:
  


Current Time: Tue Apr 23 17:54:51 CDT 2024