On Thu, Jul 3, 2014 at 8:30 AM, Arup Rakshit <aruprakshit@xxxxxxxxxxxxxx> wrote:
Hi,One query is producing the below table :-answer | count | avga1 3 14a2 2 10How to convert this to a single row table ?count | avg_a1 | avg_a25 14 10Regards,
Arup Rakshit
select count(*)
, avg(case when answer='a1' then whatever_value else null end) as avg_a1
, avg(case when answer='a1' then whatever_value else null end) as avg_a1
, avg(case when answer='a2' then whatever_value else null end) as avg_a2
from my_table
I asked the Internet how to train my cat, and the Internet told me to get a dog.