Hello, i am trying to put a query together but not able to have a count of tba or dos for each itmsgrpcod. It is just showing the same value for each row
SELECT T0.[ItmsGrpCod],
(SELECT COUNT(T0.[U_Category]) AS TBA FROM OITM T0 WHERE T0.[U_Category] = 'TBA') AS 'TBA',
(SELECT COUNT(T0.[U_Category]) AS DOS FROM OITM T0 WHERE T0.[U_Category] = 'DOS') AS 'DOS'
FROM OITM T0
GROUP BY T0.[ItmsGrpCod]
please can anyone help?
many thanks
Brian
SELECT T0.[ItmsGrpCod],
(SELECT COUNT(T0.[U_Category]) AS TBA FROM OITM T0 WHERE T0.[U_Category] = 'TBA') AS 'TBA',
(SELECT COUNT(T0.[U_Category]) AS DOS FROM OITM T0 WHERE T0.[U_Category] = 'DOS') AS 'DOS'
FROM OITM T0
GROUP BY T0.[ItmsGrpCod]
please can anyone help?
many thanks
Brian