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)
 records in a table where a certian value under a certian key (hard to explain) doesn't exist

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-05-22 : 09:18:41
Dave writes "SQLServer 2000
Windows 2000 ( sp2 )

I want to find out how many records in a table by id have no field of a certian value.. the table is like so..

person_id (not unique) | person_type
-------------------------------------
1 | bad
-------------------------------------
1 | mean
-------------------------------------
1 | ugly
-------------------------------------
2 | bad
-------------------------------------
2 | ugly
-------------------------------------
3 | bad
-------------------------------------
3 | ugly
-------------------------------------
4 | bad
-------------------------------------
4 | mean
-------------------------------------
4 | ugly

Using SQL, how would I find out which person_id's do not have an associated 'mean' value for their person_type? (in this case person_id's 2 and 3)"
   

- Advertisement -