mr_badger Posted May 20, 2008 Share Posted May 20, 2008 I have a site that has music artists and when you click on an artist's name you are taken to there biography. I have this working fine but I want to be able list the albums they have done. I have created a new table called albums with all the details and I need to join this table with the artists table, I have got it to the point where it's listing all albums but I'm struggling with seperating what album each artist has done. This is my recordset I have now. SELECT * FROM blg_albums INNER JOIN blg_article_art ON id_art=album_id ORDER BY album_title ASC blg_article_art is the table with the artists details. I'm guessing this shouldn't be difficult as I kinda have it working to a point. Link to comment https://forums.phpfreaks.com/topic/106538-solved-hope-you-can-help-me-with-joining-tables/ Share on other sites More sharing options...
MadTechie Posted May 20, 2008 Share Posted May 20, 2008 i think you want to join the artists to the album.. ie SELECT * FROM blg_article_art LEFT JOIN blg_albums ON id_art=album_id ORDER BY album_title ASC have you got some sample data with an example of what you want to display Link to comment https://forums.phpfreaks.com/topic/106538-solved-hope-you-can-help-me-with-joining-tables/#findComment-546132 Share on other sites More sharing options...
mr_badger Posted May 20, 2008 Author Share Posted May 20, 2008 Yes, I have data in all the tables. It says that Column 'id_art' in on clause is ambiguous Link to comment https://forums.phpfreaks.com/topic/106538-solved-hope-you-can-help-me-with-joining-tables/#findComment-546137 Share on other sites More sharing options...
mr_badger Posted May 20, 2008 Author Share Posted May 20, 2008 Thanks for the help but I have figured it out. it was simpler than I thought. this is how I did it SELECT * FROM blg_albums WHERE id_art = colname ORDER BY album_title ASC colname was $_GET['id_art'] Link to comment https://forums.phpfreaks.com/topic/106538-solved-hope-you-can-help-me-with-joining-tables/#findComment-546144 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.