Jump to content

Sql Query Help(Pivot)


Recommended Posts

Posted

naku sql  query data ila vasthundhi

 

transaction_dt   transcation type

                     

08/27/2014         taxi 

08/25/2014         landing

08/27/2014        pullout

08/27/2014        taxi

08/25/2014       pullout

08/19/2014      taxi

 

 

naaku kavalsina result

 

                    taxi    landing   pullout

08/27/2014   2       0               1

08/25/2014   0        1              1

08/19/2014   1        0               0

 

 

im trying but aa date ni group by ela cheyyalo teliyadam ledhu

 

 

 

 

Posted
Change mytable with actual database table name
 
select * from (
   select transaction_dt,   transcation_type
   from mytable t
)
pivot 
(
   count(transcation_type)
   for transcation_type in (' taxi',    'landing',   'pullout')
)
order by transaction_dt;
  • Upvote 1
×
×
  • Create New...