I'd like to get the following query workin with Mysql 3.x.
"customers" table
id name email
=============== =============== ====
1 John john@email.com
2 Marvin mrv@yahoo.com
....
"orders" table
id customer_id price
=============== ==============
1 1 5.00
2 2 10.00
1 1 7.00
....
Here's the query
Select * FROM customers a INNER JOIN
(SELECT COUNT(id) as numOrders, SUM(price) as totprice, customer_id FROM
orders GROUP BY customer_id) b ON a.id=b.customer _id).
How should I rewrite the query to get it working on mysql 3?
Id like to get this result
id name email numOrders totprice
=============== =============== ===========
.... ... .. ... ...
Any suggestion?
Tac
"customers" table
id name email
=============== =============== ====
1 John john@email.com
2 Marvin mrv@yahoo.com
....
"orders" table
id customer_id price
=============== ==============
1 1 5.00
2 2 10.00
1 1 7.00
....
Here's the query
Select * FROM customers a INNER JOIN
(SELECT COUNT(id) as numOrders, SUM(price) as totprice, customer_id FROM
orders GROUP BY customer_id) b ON a.id=b.customer _id).
How should I rewrite the query to get it working on mysql 3?
Id like to get this result
id name email numOrders totprice
=============== =============== ===========
.... ... .. ... ...
Any suggestion?
Tac
Comment