karldesign Posted September 21, 2007 Share Posted September 21, 2007 I have two tables, tbl_places and tbl_places_ratings The problem I have i this. I am trying to retrieve the highest rated places from the places table, using the ratings table. However, there are multiple ratings for each place. ie: 1 place can have many ratings. I want to calculate the rating total and then output the list ordered by rating high/low depending on my choice... any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/70170-multi-table-query-problem/ Share on other sites More sharing options...
pikemsu28 Posted September 21, 2007 Share Posted September 21, 2007 i would set up a view that averages the ratings from the ratings table with the id to the places table. this way you can just do a search from the view and get a 'top whatever' list according to the averages. Quote Link to comment https://forums.phpfreaks.com/topic/70170-multi-table-query-problem/#findComment-352462 Share on other sites More sharing options...
Illusion Posted September 21, 2007 Share Posted September 21, 2007 I want to calculate the rating total and then output the list ordered by rating high/low depending on my choice... any ideas? You can be more specific on this, what I understand is you want to sum the rankings of each id and order with that total. Quote Link to comment https://forums.phpfreaks.com/topic/70170-multi-table-query-problem/#findComment-352477 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.