Re: distinct and counting

From: Lawrence James <James.Lawrence_at_epamail.epa.gov>
Date: Wed, 23 Nov 1994 11:13:00 GMT
Message-ID: <James.Lawrence.23.000B37CB_at_epamail.epa.gov>


In article <3aiso9INN6ac_at_oasys.dt.navy.mil> wybranie_at_oasys.dt.navy.mil (Suzanne Wybraniec) writes:
>From: wybranie_at_oasys.dt.navy.mil (Suzanne Wybraniec)
>Subject: distinct and counting
>Date: 18 Nov 1994 13:45:29 -0500
 

>
>I would like to query two fields in a table, and produce a result without
>printing the duplicates. The ways I've tried to structure the select
>statement all meet with errors.
 

>Table data samples:
>BLDG ROOM
> 1 A
> 1 A
> 1 B
> 1 C
> 1 C
> 1 C
> 2 A
> 2 B
> 2 B
>
>I want a report that looks like:
>BLDG ROOM (no heading on this column)
> 1 A 2 pieces are located here
> 1 B
> 1 C 3 pieces are located here
> 2 A
> 2 B 2 pieces are located here
 

>Thanks,
>Suzanne
>

Select bldg, room, count(*) from <table> group by bldg, room;

Lawrence.... Received on Wed Nov 23 1994 - 12:13:00 CET

Original text of this message