Home » SQL & PL/SQL » SQL & PL/SQL » pbs with count function
pbs with count function [message #19766] Mon, 08 April 2002 05:53 Go to next message
Antoni
Messages: 8
Registered: February 2002
Junior Member
Hi all,

i want to count different rows of a table with different conditions and i want the result with a single query, example:

code type_Car type_motorcycle
203 4 6
123 5 6
122 4 7
203 4 5

and i want to count for each code the number of type_car = 4 and the number of type_motorcycle = 6
so that the result will be:

code count (type_car) count (type_motorcycle)
203 2 1
123 0 1
122 1 0

thanks a lot
Re: pbs with count function [message #19767 is a reply to message #19766] Mon, 08 April 2002 07:02 Go to previous message
Elic
Messages: 3
Registered: April 2002
Junior Member
select code, count(decode(type_car,4,1)), count(decode(type_motorcycle,6,1))
from ... group by code
Previous Topic: HELP.....the table did exit when I connect on the DB server, but disapear when I connect from other
Next Topic: date
Goto Forum:
  


Current Time: Mon Mar 18 22:59:36 CDT 2024