I have this block of code:
(SELECT SELL_STR.SELL_STR_NBR, DATES.PSTD_FSCL_YR_WK, count(*) as WKLY_DLVRY--, WORK_ORD_NBR
from `analytics-df-thd.DFS.FACTS_DLY_DELV_STATS` A
inner join R1
on r1.FSCL_YR_WK = A.DATES.PSTD_FSCL_YR_WK
group by SELL_STR.SELL_STR_NBR, DATES.PSTD_FSCL_YR_WK
)
I need to add WORK_ORD_NBR to the SELECT so I can later join it
select
WKLY_DLVRY.WKLY_DLVRY
...
from table1 a
join
WKLY_DLVRY
on WKLY_DLVRY.WORK_ORD_NBR = a.WORK_ORD_NBR
However when added to WKLY_DLVRY, I receive this error:
SELECT list expression references column WORK_ORD_NBR which is neither grouped nor aggregated at
I have read many threads and they didn't give me many options, only suggesting that WORK_ORD_NBR must be grouped, however that changes the count. I appreciate any help