MySQL Forums
Forum List  »  Newbie

Need help with a Query....cross tab format
Posted by: sridhar ventapalli
Date: July 28, 2010 07:08AM

Hello is my problem

i have a table farebox(busnum,route,direction,revdt,fare) like this

101|1 |N |07/01/2010| 4
102|1 |N |07/01/2010| 3
103|1 |S |07/02/2010| 5
103|2 |E |07/03/2010| 3

(sorry, try to match the values with labels)

it goes on like this

now I need to get data in this format

Rout|dir|July1|July2|July3|...........| July31|
..1..|.N.|..7..|..0..|..0..|...........| 0
..1..|.S.|..0..|..5..|..0..|...........| 0

the columns with date label is nothing but sum of fare on that date for perticular route and direction.(dots are just for format sake)

Any sort of help is Appriciated.


Options: ReplyQuote

Written By
Need help with a Query....cross tab format
July 28, 2010 07:08AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.