SQL: UPDATE by SELECT
Need update t_reports table, column tanked_sum. t_reports – reports table – tanked_sum – sum of tanked from t_vehicles table t_vehicles – vehicles table (more than one vehicle is in one report) – tanked – refueled liters of fuel for one vehicle — select only (count in `tanked_sum_counted` column) SELECT tanked_sum_counted, * FROM t_reports r JOIN ( SELECT Read more about SQL: UPDATE by SELECT[…]