o0Loco0o Posted September 18, 2012 Share Posted September 18, 2012 I have 3 tables, and what I am trying to do is get this to output just the characters.name and appropriate guild.name for that character. Table: characters Columns: guid, name Table: guild_member Columns: guid, guildid Table: guild Columns: guildid, name I have tried this query: SELECT characters.name, guild.name FROM characters, guild WHERE guild_member.guid = characters.guid AND guild_member.guildid = guild.guildid But it did not work... =( Please Help! Thank you in advance! Quote Link to comment Share on other sites More sharing options...
Christian F. Posted September 18, 2012 Share Posted September 18, 2012 Use explicit JOINs instead of the implicit ones you've used above. The explicit ones gives you more control, and considerably lessens the risk of getting a Cartesian product. Not to mention that they make it a whole lot easier to read what's actually going on. That said you do have a problem with your logic here, as you're only joining two of the three tables. Also, since this appears to be a many-to-many relation you might want to read up on how them. There are plenty of good guides online, so just search about until you find one. Mind the crappy ones though. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.