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.
| Author |
Topic |
|
sqlbee
Starting Member
11 Posts |
Posted - 2003-08-11 : 14:33:56
|
| hi,I need some help. I have one questionWe have employee dependent plan_type1 2 BC001 2 HL1 2 VO1 3 HL1 4 VOFrom this we need only those records that have not allthree 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, dependentfrom tablegroup by employee, dependenthaving count(distinct plan_type) < 3) bon a.employee = b.employee and a.dependent = b.dependent |
 |
|
|
|
|
|