steelerman99 Posted February 24, 2009 Share Posted February 24, 2009 Hello everyone! Let's say I have the following tables: TABLE - SONGS ID - SONG 1 - Back in Black 2 - Evenflow 3 - Voodoo Child 4 - Jump Around ID is primary key TABLE FAVS ID - Person - Song1 - Song2 1 - Jeff - 1 - 3 2 - Steve - 2 - 1 3 - Brett - 3 - 4 ---------------------------------- What would be the SQL join query to show the song name in the FAVS table instead of the id so when the query is executed it looks like this: 1 - Jeff - Back in Black - Voodoo Child 2 - Steve - Evenflow - Back in Black 3 - Brett - Voodoo Child - Jump Around THANKS! Quote Link to comment https://forums.phpfreaks.com/topic/146641-join-with-2-primary-key-fields/ Share on other sites More sharing options...
fenway Posted February 24, 2009 Share Posted February 24, 2009 Song1 ... Song2 ... that's not normalized. Read the stickies on DB normalization before you go any further. Quote Link to comment https://forums.phpfreaks.com/topic/146641-join-with-2-primary-key-fields/#findComment-770179 Share on other sites More sharing options...
steelerman99 Posted February 25, 2009 Author Share Posted February 25, 2009 Song1 ... Song2 ... that's not normalized. Read the stickies on DB normalization before you go any further. Ah, I see. So basically that would be impossible to list it my way, huh? Quote Link to comment https://forums.phpfreaks.com/topic/146641-join-with-2-primary-key-fields/#findComment-770769 Share on other sites More sharing options...
fenway Posted February 25, 2009 Share Posted February 25, 2009 Not impossible, just highly undesirable. Quote Link to comment https://forums.phpfreaks.com/topic/146641-join-with-2-primary-key-fields/#findComment-770829 Share on other sites More sharing options...
steelerman99 Posted February 26, 2009 Author Share Posted February 26, 2009 Can anyone give a code snippet that would help me out? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/146641-join-with-2-primary-key-fields/#findComment-771657 Share on other sites More sharing options...
fenway Posted February 28, 2009 Share Posted February 28, 2009 With or without normalizing? Quote Link to comment https://forums.phpfreaks.com/topic/146641-join-with-2-primary-key-fields/#findComment-773294 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.