Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 help

Author  Topic 

sqlbee
Starting Member

11 Posts

Posted - 2003-08-11 : 14:33:56
hi,
I need some help. I have one question

We have
employee dependent plan_type
1 2 BC00
1 2 HL
1 2 VO
1 3 HL
1 4 VO

From this we need only those records that have not all
three plans.
eg. they don't want first three records.
What is the best way to do this?
thanks.
employee and dependent is the key.
rita

drymchaser
Aged Yak Warrior

552 Posts

Posted - 2003-08-11 : 14:49:01
select a.* from table a join (
select employee, dependent
from table
group by employee, dependent
having count(distinct plan_type) < 3) b
on a.employee = b.employee and a.dependent = b.dependent
Go to Top of Page
   

- Advertisement -