select
extract(year from datetimestamp ) Yr,extract(month from datetimestamp) Mn,
c.weekday_of_month wk, a.aircraft_type,count( a.aircraft_type) from fcm_bv.Flights b
join fcm_bv.Fleet a on b.aircraftid=a.tail
join SYS_CALENDAR.CALENDAR c
on cast(b.datetimestamp AS DATE FORMAT YYYY-MM-DD ) = cast(c.calendar_date AS DATE FORMAT YYYY-MM-DD )
where cast(datetimestamp as date) >= 2011-09-01
and cast(datetimestamp as date) <= 2011-09-30 order by wk
group by Yr,Mn,wk,a.fleet,a.aircraft_type
While Running above Query I am getting out put like this
Yr Mn wk AIRCRAFT_TYPE Count(AIRCRAFT_TYPE)
2011 9 1 B737-700 1744
2011 9 1 B737-800 131
2011 9 1 B737-800W 2711
2011 9 1 B737-8BK 180
2011 9 1 B737-700W 329
但我需要以下格式的产出:
Yr Mn wk B737-700 B737-800 B737-800W B737-8BK B737-700W
2011 9 1 1744 131 2711 180 329
谁能帮助我