편집 얻기 : 이는 글로벌 sql_mode 설정을 변경할 수있는 대답에 질문 #1055 - Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column this is incompatible with sql_mode=only_full_group_byGROUP BY의 MySQL 처리. ONLY_FULL_GROUP_BY 오류를
이 올바르지의 가능한 중복 된 것으로 확인되었습니다. MySQL은 ONLY_FULL_GROUP_BY를 기본으로 변경했습니다. functional dependencies and returning arbitrary data
제 질문과 대답은 간략하지만 정확하지만 더 자세한 내용을 사용하여 설명을 간략히 설명합니다. 그래서
+-----------+-------------+-----------+----------+-------+
| productID | productCode | name | quantity | price |
+-----------+-------------+-----------+----------+-------+
| 1001 | PEN | Pen Red | 5000 | 1.23 |
| 1002 | PEN | Pen Blue | 8000 | 1.25 |
| 1003 | PEN | Pen Black | 2000 | 1.25 |
| 1004 | PEC | Pencil 2B | 10000 | 0.48 |
| 1005 | PEC | Pencil 2H | 8000 | 0.49 |
+-----------+-------------+-----------+----------+-------+
내가 명령을 실행하는 경우 : 그래서
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'southwind.products.productID' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
에서 : 나는 다음과 같은 오류가
SELECT * FROM products GROUP BY productCode;
을 다음과 같이
읽어 주셔서 감사합니다, 테이블입니다 내 GROUP BY 인수에 중복 값이 있기 때문에 mysql documentation을 읽었습니다. 임의로 뭔가를 반환하기를 거부하면서 오류가 발생합니다. 차라리이 기능을 사용 중지하지 않으므로 쿼리 작업을 위해 누락 된 부분을 이해하는 데 도움이됩니다.
감사합니다.
당신의 모드에 따라
각 productCode에 동일한 행이 없으므로 각 행에 대해 원하는 행을 반환 하시겠습니까? – Mihai