MPVM Posted August 16, 2009 Share Posted August 16, 2009 Hi PHP Freaks! I have a problem joining 3 mysql tables together my tables are: games - id - name category - id - cat rating - id - rating I want to merge them together so i can get: - id - name - cat - rating The rating should be used with the AVG function during the JOIN I've tried a lot myself but can not make i work Can somebody write a SQL query that will work? Thanks in advance! MPVM Link to comment https://forums.phpfreaks.com/topic/170533-join-3-sql-select-together/ Share on other sites More sharing options...
sKunKbad Posted August 16, 2009 Share Posted August 16, 2009 You ought to post this in the MySQL forum. Link to comment https://forums.phpfreaks.com/topic/170533-join-3-sql-select-together/#findComment-899529 Share on other sites More sharing options...
ignace Posted August 16, 2009 Share Posted August 16, 2009 games ------ id cat_id name category -------- id cat rating ----- game_id rating count SELECT games.name, category.*, rating.rating, rating.count FROM games LEFT JOIN category ON games.cat_id = category.id LEFT JOIN rating ON games.id = rating.game_id Link to comment https://forums.phpfreaks.com/topic/170533-join-3-sql-select-together/#findComment-899550 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.