I have a table with the following columns:
lid subject id
period period for sample i.e. day 1, day 30
labdt date
sample sample type
there also others, but they are not relevant
For each combination of these fields, there should be 20 rows similiar
to the following; there are 20 different samples:
lid period labdt sample
0001 day 1 01/01/2001 glucose
0001 day 1 01/01/2001 sodium
i need a query that will show me any combination of the above that
does not have exactly 20 rows, ie the combination of lid, period and
labdt is >20 or <20
Gert van der Kooij - 25 May 2004 21:08 GMT
> I have a table with the following columns:
>
[quoted text clipped - 15 lines]
> does not have exactly 20 rows, ie the combination of lid, period and
> labdt is >20 or <20
select lid, period, labdt, count(*)
from table
group by lid, period, labdt
having count(*) <> 20