0

Hi I'm having trouble with pivot, i'm doing an internship and they asked me to produce a report in excel. I've already produced excel reports based on pl/sql but i can't manage to get the right code for the diplay. I'm not sure if pivot is the best idea but this is all that i have in mind.

This is how the excel should look like

    A                B        C      D       E     
                   9:00     9:30   10:00   10:30 
Valleyfield          1        2       2      2 
St-Thomas            2        3       1      4
Zalau                0        4       5      1

and this is what i have from sql code

nb_embarquement   Heure        Zone
    2             9:00       Valleyfield  
    3             10:30      Valleyfield  
    4             9:30       St-Thomas
    1             11:00      Zalau 

there are more than 4 results but just to get the visual

THIS IS THE SQL IM USING :

 select c.nb_embarquement, th.heure || ':' || th.minutes as heure, z.nom_zone
 from txb_demandes d, txb_trajets_heures th, txb_courses c, txb_zones z
  where d.id_course = c.id_course
  and d.id_trajet_heure = th.id_trajet_heure
  and d.id_demande_parent is null
  and c.id_zone = z.id_zone
user2672165
  • 2,986
  • 19
  • 27
  • Already described at this post http://stackoverflow.com/questions/7674786/mysql-pivot-table – Up_One Mar 10 '14 at 19:07
  • @Up_One OP possibly meant not MySQL, but Oracle database. Though there are a lot of explanations too. @user3402991 Google for `PIVOT` statement. – Yaroslav Shabalin Mar 11 '14 at 06:25

0 Answers0