When I run this query I get the following error:
Column MANUFACTURER or expression in SELECT list not valid.
The query runs fine if I remove the COUNT function.
Any ideas?
(this query is a bit of a mock so it might not make perfect sense)
SELECT
MANUFACTURER
, PART_NUMBER
, COUNT(1) AS CNT
FROM
( SELECT
AWPART AS PART_NUMBER
, MANF AS MANUFACTURER
FROM STKMP
INNER JOIN PRICING AS P
ON AWPART = P.JCPART
AND R.CODE = 1
WHERE PART_NUMBER LIKE '%A2%') AS T
Modifying the last line as follows produces the same effect.
WHERE PART_NUMBER LIKE '%A2%') AS T GROUP BY MANUFACTURER
Typically COUNT()
is only meaningful if you have a GROUP BY
clause. Perhaps you meant to add this to the end (after the AS T
?):
GROUP BY MANUFACTURER, PART_NUMBER;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.