Andrew Carlson wrote:
Is there a purchase order (10002) with no orders in the order_details table?

No, PO 10002 is related to the order_id = 2 here:

mysql> SELECT order_id, SUM(quantity * unit_price) AS subtotal
   -> FROM order_details GROUP BY order_id;

+----------+----------+
| order_id | subtotal |
+----------+----------+
|        1 |   101.94 |
|        2 |    47.97 |
+----------+----------+

But i'm getting NULL for subtotal on all of them, anyway.

The same query works as exactly as expected in Postgres with some table modifications to allow for the different datatypes. The outer query should have no problem grabbing the correct subtotal from the joined query.

b

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to