IanNav
Programmer
- Feb 26, 2001
- 79
SELECT company.mediaredirect. * , COUNT( company_orders.old_orderdetails.id ) , COUNT( company_orders.orderdetails.id ) FROM company.mediaredirect LEFT JOIN company_orders.old_orderdetails ON company_orders.old_orderdetails.mediasource = company.mediaredirect.code LEFT JOIN company_orders.orderdetails ON company_orders.orderdetails.mediasource
= company.mediaredirect.code
GROUP BY company.mediaredirect.id
ORDER BY company.mediaredirect.count DESC
if the count of the company_orders.old_orderdetails.id is greater than 1, the next count is repeated by however many results are in the first column.
in this instance, the count of company_orders.old_orderdetails.id is 2 and the count of company_orders.orderdetails.id is 2 - when in reality, the count of the latter should = 1.
any assistance you can provide in this matter would be greatly appreciated.
= company.mediaredirect.code
GROUP BY company.mediaredirect.id
ORDER BY company.mediaredirect.count DESC
if the count of the company_orders.old_orderdetails.id is greater than 1, the next count is repeated by however many results are in the first column.
in this instance, the count of company_orders.old_orderdetails.id is 2 and the count of company_orders.orderdetails.id is 2 - when in reality, the count of the latter should = 1.
any assistance you can provide in this matter would be greatly appreciated.