I have a list of stores and the turnover:
SELECT
CASE WHEN SELLER_ID IN ('X','Y') THEN 'SALON' ELSE STORES_ID END AS 'STORES',
SUM (TURNOVER)
FROM PIECE
GROUP BY STORES_ID ,SELLER_ID
The problem is that I don't want to use the field SELLER_ID
in the group by:
Result:
STORE TURNOVER
S1 500
S1 500
S2 600
S2 600
S3 550
S3 550
Excepted result: I want to have the sum turnover for each store in one row, but I want only to divis one store in 2 rows when SELLER_ID IN ('X','Y')
Let's say that S3 it's the store that I want to devis:
S1 500
S2 300
S3 250
SALON 200