아래 코드 고려 : 내가 마지막 줄을 제거하면SQL Server 오류 "열이 유효하지 않습니다"가 표시되는 이유는 무엇입니까?
select vend_id, COUNT(vend_id) as num_prods
from Products
group by vend_id
을, 나는 다음과 같은 오류가 발생합니다 :
Column 'Products.vend_id' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
왜이 오류는 어떻게해야합니까? 내가 (카운트가 어떻게 작동하는지 이해함) 실수는 무엇입니까? 하여 그룹을 사용하지 않고 쿼리를 작성
count()가 얼마나 정확하게 작동하는지 알려주세요. 어쩌면 내 개념적 이해가 잘못되었을 수도 있습니다. – YourDataInsecure
당신이 맞다고 생각합니다. 열의 철자가 올바른지 확인하십시오. – zneak
원하는 결과는 무엇입니까? – dodexahedron