Thanks, I've been at work, tried this and it worked.
select product, SUM(CASE WHEN type = 'hotel' THEN sold ELSE 0 END)
SUM(CASE WHEN type = 'b&b' THEN sold ELSE 0 END)
SUM(CASE WHEN type = 'inn' THEN sold ELSE 0 END)
from sales group by product
There are several problems with that. I read company's base on my work, but they are not happy with me using it so I cant ask for advice. I don't have access to internet from work so I can't be looking for solutions from there. I did search forums, but my English and knowledge of SQL waren't...
I have a table like this
Product type sold
beer hotel 20
beer hotel 30
beer inn 20
beer inn 40
coke b&b 20
coke hotel 40
coke hotel 10
and want to get the result like
product hotel inn b&b
beer 50 60 0
coke 50 0 20
How to write a query (Oracle)
Thanks
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.