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 |
|
umapathy
Starting Member
24 Posts |
Posted - 2007-09-06 : 03:46:28
|
| Hi i have a table namely x which contains two columns movie and actor.i want to find out movie name in which more than one actor acted in same movie.Movie Actorx ax by cz dMy expected result set is x |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-09-06 : 03:55:21
|
| [code]SELECT Actor, MovieFROM MyTable AS T JOIN ( SELECT Actor FROM MyTable GROPU BY Actor HAVING COUNT(*) > 1 ) AS X ON X.Actor = T.Actor[/code]Kristen |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-09-06 : 03:56:34
|
Scratch that, that was Actors who have made more than one movie ...try again:SELECT MovieFROM MyTableGROUP BY MovieHAVING COUNT(*) > 1 Kristen |
 |
|
|
umapathy
Starting Member
24 Posts |
Posted - 2007-09-06 : 04:32:31
|
| No,How many person acted in a Same Move?Thanks Umapathy |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-09-06 : 06:03:12
|
"How many person acted in a Same Move?"that's not the same as "i want to find out movie name in which more than one actor acted in same movie"Modifying my code above:SELECT Movie, [Actors] = COUNT(*)FROM MyTableGROUP BY Movie Kristen |
 |
|
|
|
|
|