The Little Guy Posted December 5, 2008 Share Posted December 5, 2008 I would like to perform a query similar to this: UPDATE `search_video` SET `search_video`.`rank` = ROUND(AVG(`votes`.`vote`)) WHERE `id` = 'iBfH0qsrowWuS' GROUP BY `votes`.`objID` In one table I have a list of numbers and an id (currently the id's are all the same) but in that table I want to take the average of the current id's and round (works). Next I want to use that result and update another table, how can I do that? The above is what I currently have. Link to comment https://forums.phpfreaks.com/topic/135722-solved-update-one-table-from-another-table/ Share on other sites More sharing options...
The Little Guy Posted December 5, 2008 Author Share Posted December 5, 2008 nvm I got it UPDATE `search_video` SET `search_video`.`rank` = (SELECT ROUND(AVG(`votes`.`vote`)) FROM `votes` WHERE `objID` = 'iBfH0qsrowWuS') WHERE id = 'iBfH0qsrowWuS' Link to comment https://forums.phpfreaks.com/topic/135722-solved-update-one-table-from-another-table/#findComment-707172 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.