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 |
|
mary H
Starting Member
32 Posts |
Posted - 2008-10-10 : 01:45:29
|
| I need to list a dog_id and name for each dog that has been placed one or more times.I have two tables dog and place.Dog table looks like this:Name /dog_idRocky/1021Bee/2012Rose/3014Lilly/401etc...Place table looks like this:dog_id/place1021/12012/23014/31021/12012/3I need a subquery to check which dog has been placed one or more times.Any ideas |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-10 : 01:59:39
|
| [code]SELECT d.*FROM Dog dJOIN (SELECT dog_id FROM Place GROUP BY dog_id HAVING COUNT(place)>=2)tOn t.dog_id=d.dog_id[/code] |
 |
|
|
mary H
Starting Member
32 Posts |
Posted - 2008-10-10 : 04:44:42
|
Thank you visakh16! I appreciate your help |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-10 : 04:51:27
|
quote: Originally posted by mary H Thank you visakh16! I appreciate your help
welcome |
 |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2008-10-10 : 05:40:25
|
| why would you want to delete it?Em |
 |
|
|
mary H
Starting Member
32 Posts |
Posted - 2008-10-10 : 05:42:36
|
quote: Originally posted by elancaster why would you want to delete it?Em
No this thread...Ive made other threads and got clues... |
 |
|
|
|
|
|