我想從兩個表中執行復雜查詢......這是一個技能測驗的問題。Mysql Query:表示子查詢返回多於1行的錯誤
表
**Orders Customer**s
id id
date first_name
shipping_amount last_name
order_status city
customer_id (Customers.id) state
輸出
-----------+------------+
| State | # Orders |
+-----------+------------+
| NY | 55 |
| CA | 40 |
| NJ | 33 |
| FL | 21 |
| MO | 12 |
+-----------+------------+
我一直在我的查詢,它看起來像這樣...
select DISTINCT state, (select count(id) Orders
from customers
group by state
ORDER BY Orders DESC) FROM Customers
它給了我,說子查詢的錯誤返回多於一行
似乎是類似於http://stackoverflow.com/questions/3340079/tough-mysql-query – 2010-07-27 08:40:29