williamsba
Programmer
Here is my query:
SELECT o.orderid, o.po_id, ((SUM(op.quantity) / 3) / 4) as itemtotal, COUNT(*) as counter
FROM orders o
INNER JOIN order_products op ON rderID = op.OrderID
INNER JOIN applications a ON op.app_ID = a.app_id
INNER JOIN products p ON a.prodcode = p.prodcode
WHERE o.orderid = 'CC1098179'
GROUP BY o.orderid, o.po_id
Ok so this will return one record similar to this:
Order ID | PO ID | Item Total | Counter
343242 | 34234 | 4 | <NULL>
What I want to happen is return as many records as [Item Total] equals and count. So in this case it would return
Order ID | PO ID | Item Total | Counter
343242 | 34234 | 4 | 1
343242 | 34234 | 4 | 2
343242 | 34234 | 4 | 3
343242 | 34234 | 4 | 4
Possible or not?
Brad Williams
Webmaster
SELECT o.orderid, o.po_id, ((SUM(op.quantity) / 3) / 4) as itemtotal, COUNT(*) as counter
FROM orders o
INNER JOIN order_products op ON rderID = op.OrderID
INNER JOIN applications a ON op.app_ID = a.app_id
INNER JOIN products p ON a.prodcode = p.prodcode
WHERE o.orderid = 'CC1098179'
GROUP BY o.orderid, o.po_id
Ok so this will return one record similar to this:
Order ID | PO ID | Item Total | Counter
343242 | 34234 | 4 | <NULL>
What I want to happen is return as many records as [Item Total] equals and count. So in this case it would return
Order ID | PO ID | Item Total | Counter
343242 | 34234 | 4 | 1
343242 | 34234 | 4 | 2
343242 | 34234 | 4 | 3
343242 | 34234 | 4 | 4
Possible or not?
Brad Williams
Webmaster