두 테이블에서 복잡한 쿼리를 수행하려고합니다. 스킬 퀴즈에서 질문입니다.MySQL 쿼리 : 하위 쿼리가 두 행 이상을 반환하는 오류
테이블
**Orders Customer**s
id id
date first_name
shipping_amount last_name
order_status city
customer_id (Customers.id) state
출력 그것은 나에게 하위 쿼리라는 오류를 준
select DISTINCT state, (select count(id) Orders
from customers
group by state
ORDER BY Orders DESC) FROM Customers
-----------+------------+
| State | # Orders |
+-----------+------------+
| NY | 55 |
| CA | 40 |
| NJ | 33 |
| FL | 21 |
| MO | 12 |
+-----------+------------+
내 쿼리에 노력하고있다 그것은 다음과 같습니다 ... 1 행 이상을 반환합니다.
이 http://stackoverflow.com/questions/3340079/tough-mysql-query과 비슷한 것 같다 –