January 14, 2018 at 11:07 am
Hi guys, my question is the following:
How is the sumatory (sum(units_sold)) giving me the number of units and not the sumatory of all the units made by the publisher FCA?
Could you give me some advice on it?
This is what I've done until now:
SELECT TITLE, SUM(UNITS_SOLD)
FROM BOOKS
WHERE (TITLE,UNITS_SOLD) IN(SELECT TITLE, UNITS_SOLD
FROM BOOKS B, PUBLISHER P
WHERE B.CODE_PUBLISHER=P.CODE_PUBLISHER AND P.NOME LIKE '%FCA%')
GROUP BY TITLE;
January 17, 2018 at 5:29 am
Thank you! 🙂
January 17, 2018 at 9:34 am
joao.piti98 - Sunday, January 14, 2018 11:07 AMHi guys, my question is the following:
How is the sumatory (sum(units_sold)) giving me the number of units and not the sumatory of all the units made by the publisher FCA?
Could you give me some advice on it?This is what I've done until now:
SELECT TITLE, SUM(UNITS_SOLD)
FROM BOOKS
WHERE (TITLE,UNITS_SOLD) IN(SELECT TITLE, UNITS_SOLD
FROM BOOKS B, PUBLISHER P
WHERE B.CODE_PUBLISHER=P.CODE_PUBLISHER AND P.NOME LIKE '%FCA%')
GROUP BY TITLE;
This doesn't look like MS SQL Server. Are you using Oracle, as it looks an Oracle construct with the IN clause.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply