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 2008 Forums
 Transact-SQL (2008)
 Return records based upon filter + related records

Author  Topic 

ino mart
Starting Member

12 Posts

Posted - 2014-08-29 : 06:47:06
All

I need to filter out all records where the value is less than 100 + all other records of the affected person (regardless the value).

Let's assume I have next table
Joe 500
Joe 200
Joe 150
John 50
John 99
Betty 101
Betty 199
Liz 89
Liz 102
Brad 87
Brad 888

My SQL-string must return next records
John 50
John 99
Liz 89
Liz 102
Brad 87
Brad 888

Betty and Joe are not returned as all their values are higher than 100.

How can this be done?

Regards
Ino

djj55
Constraint Violating Yak Guru

352 Posts

Posted - 2014-08-29 : 07:25:49
Try a cte to find name that has < 100 then use that to get your result.

djj
Go to Top of Page
   

- Advertisement -