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 |
|
jnmunsey
Starting Member
4 Posts |
Posted - 2006-04-13 : 02:41:26
|
| I have one table with(many to many relationship):performeridperformernameeventidanother table with:eventideventnameI want to make a query that lists all eventnames for a given performeridAny help is appreciated |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-04-13 : 02:43:40
|
use INNER JOINselect e.eventid, e.eventname, p.performerid, p.performernamefrom event e inner join perform p on e.eventid = p.eventid KH |
 |
|
|
jnmunsey
Starting Member
4 Posts |
Posted - 2006-04-13 : 02:54:18
|
| Never mind I figured it out on the first try...SELECT Events.* FROM EventPerformers LEFT JOIN Events ON EventPerformers.EventID=Events.EventID WHERE EventPerformers.EventID = Events.EventID AND EventPerformers.PerformerID = 6161 is a performeridoh and this was for MySQL |
 |
|
|
jnmunsey
Starting Member
4 Posts |
Posted - 2006-04-13 : 02:56:12
|
| thanks khtan.. Is there any performance issue with my solution? It seems to work just fine. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-04-13 : 03:01:45
|
quote: Originally posted by jnmunsey thanks khtan.. Is there any performance issue with my solution? It seems to work just fine.
as long as you have index for the eventid and performeridquote: oh and this was for MySQL
Oh ! this is a MS SQL Server forum  KH |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-04-13 : 03:36:56
|
| >>oh and this was for MySQLPost your MySQL questions at www.DBForums.com or www.MySQL.comMadhivananFailing to plan is Planning to fail |
 |
|
|
jnmunsey
Starting Member
4 Posts |
Posted - 2006-04-13 : 03:41:02
|
| Thanks, but with a response as fast a this, I might just come back here (it was a generic SQL question after all). Plus, I might be able to help someone some day. |
 |
|
|
|
|
|