string_agg not recognized as a grouping function
eklein@ahd.com
Posts: 17 Bronze 2
in SQL Prompt
Running version 9.1.1.4243
I had following code
When I added a group by and selected "all non-aggregated columns" prompt added the following
Apparently it did not recognize the string_agg function as grouping function as it would if I had specified SUM()
Thanks for you product and support
I had following code
SELECT TOP ( 50 ) cd.RPT_REC_NUM
, cd.component
, cd.sheet
, cd.cell_row
, STRING_AGG(
CASE WHEN cd.cell_col = '00200' THEN cd.ITM_VAL_ALPHA
ELSE NULL END) AS ccn
, STRING_AGG(
CASE WHEN cd.cell_col = '00100' THEN cd.ITM_VAL_ALPHA
ELSE NULL END) AS fname
, w.Tsheet
, w.Tline
FROM cell_data AS cd
INNER JOIN wk_col0_map AS w
ON cd.sheet = w.Ssheet
AND LEFT(cd.cell_row, 3) = w.Sline
WHERE cd.cell_col IN ( '00100', '00200' )
GROUP BY
STRING_AGG(CASE WHEN cd.cell_col = '00200' THEN cd.ITM_VAL_ALPHA
ELSE NULL END)
, STRING_AGG(CASE WHEN cd.cell_col = '00100' THEN cd.ITM_VAL_ALPHA
ELSE NULL END)
, cd.RPT_REC_NUM
, cd.component
, cd.sheet
, cd.cell_row
, w.Tsheet
, w.Tline
Apparently it did not recognize the string_agg function as grouping function as it would if I had specified SUM()
Thanks for you product and support
Tagged: