Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Im having problem trying to table this one:table.DrinksType Brand QTYCoffee Q 2Coffee Y 3Coffee L 5Tea Q 4Tea Y 1Tea L NULLI want the result to be :Type Brand Q Brand Y Brand LCoffee 2 3 5 Tea 4 1 Null Appreciate all your inputs. Thanks!!
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2007-02-01 : 22:27:47
this is cross tab / pivot query
select Type, [Brand Q] = sum(case when Brand = 'Q' then QTY else 0 end), [Brand Y] = sum(case when Brand = 'Y' then QTY else 0 end), [Brand L] = sum(case when Brand = 'L' then QTY else 0 end)from Drinksgroup by Type
KH
dknb
Starting Member
6 Posts
Posted - 2007-02-02 : 03:27:36
Hi KHError ORA-00936 : missing expression[Brand Q] was highlighted. Cheers!
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2007-02-02 : 03:29:04
because you are using Oracle !The query is in T-SQL not PL/SQL.KH