M
MArc Robillard
Hi all,
I'm new to taht forum so be kind please !
What I need to do is to popullate a list of Order with the total off it.
Some order MAY not have any details.
Sum() is ignoring Null value so I tried this :
SELECT distinct orders.Ord_id, orders.Cst_id,
(select sum(detcmd_qty * detcmd_price) as total from detOrders right join
Orders on Orders.ord_id = detOrders.ord_id) as OrderTotal
FROM orders LEFT JOIN detOrders ON orders.Ord_id = detOrders.Ord_id
WHERE (orders.Cst_id=1)
GROUP BY orders.Ord_id, detOrders.detCmd_id, orders.Cst_id
ORDER BY orders.Ord_id;
the inner select works just fine, and return a total of a specific Order
went I put an ord_id clause.
I need the OrderTotal to show in the list even IF It as no detailOrders.
Any help here would be great !
Marc.
Please responde to NewGroup.
I'm new to taht forum so be kind please !
What I need to do is to popullate a list of Order with the total off it.
Some order MAY not have any details.
Sum() is ignoring Null value so I tried this :
SELECT distinct orders.Ord_id, orders.Cst_id,
(select sum(detcmd_qty * detcmd_price) as total from detOrders right join
Orders on Orders.ord_id = detOrders.ord_id) as OrderTotal
FROM orders LEFT JOIN detOrders ON orders.Ord_id = detOrders.Ord_id
WHERE (orders.Cst_id=1)
GROUP BY orders.Ord_id, detOrders.detCmd_id, orders.Cst_id
ORDER BY orders.Ord_id;
the inner select works just fine, and return a total of a specific Order
went I put an ord_id clause.
I need the OrderTotal to show in the list even IF It as no detailOrders.
Any help here would be great !
Marc.
Please responde to NewGroup.