Codeigniter 3 Obtenez des produits les plus vendus
#You can use a SQL join between the tables on ProID, e.g.
select *
from products as p
inner join orderdetails as od
on p.ProID = od.ProID
#You can use group by syntax to ensure you get distinct rows, e.g.
group by p.ProID
#Use aggregation function such as sum, count and avg to find out the totals in a select, e.g.
select sum(od.OrderQuantity) as total
#Use order by syntax to show the top answers, e.g.
order by sum(od.OrderQuantity) desc
#Use limit to show top n results, e.g.
limit 5
#Hopefully that gives you enough pointers to formulate the SQL yourself.
#notes, I've given the tables an alias to ensure you don't get conflicts between the column names. You can't reference total in your order statement due to the way SQL calculates the dataset. I've used an inner join, but you might want to look into left & right joins.
Annoying Anaconda