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 |
|
alajata
Starting Member
1 Post |
Posted - 2012-02-10 : 10:04:37
|
| There are three tables-users,categories and photos.A category has an owner and a photo has a parent category.I need a query that finds all users who have no photos in their ategories |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-10 : 10:07:42
|
| [code]SELECT u.*FROM users uWHERE NOT EXISTS(SELECT 1 FROM categories c INNER JOIN photos p ON p.parentcategoryid = c.categoryid WHERE c.ownerid = u.userid )[/code]i've assumed column names so please make sure you use actual column names instead------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|