select tb1.id, tb1.name, sum(tb2.value) orderPrice, sum( quatity ) orderNumber
from tb1, tb2
where tb1.id=tb2.product_id
group by tb1.id
order by sum(tb2.value)
# หรือ
# order by sum(tb2.quantity)
select *, sum( dt.xxx ) ttl_xxx
from product pd, product_size sz, taxinvoice_detail dt
where pd.id=sz.product_id
and dt.taxinvoive_product=sz.sizeid
group by sz.sizeid