If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Crosstab query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-19-11, 14:48
pzh20 pzh20 is offline
Registered User
 
Join Date: Oct 2011
Posts: 1
Crosstab query

I have created crosstab queries based on a single column in a table, but now need to have ove based on multiple columns.

My table is as follows;
trandate as date
cards as dec(5,2)
cash as dec(5,2)
cheques as dec(5,2)

I want to product a crosstab as follows;

TranType Monday Tuesday Wednesday ........etc etc
cards 500.00 200.00 450.00
cash 100.00 325.00 100.00
cheques 50.00 0.00 5000.00

hints and tips would be great

Regards
Pete
Reply With Quote
  #2 (permalink)  
Old 10-19-11, 15:08
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
any reason why you couldn't do this with your application code (php or whatever)

that's where cosmetic re-arrangement of query results should take place

besides, it's way messier in sql
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Tags
aggreate, crosstab

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On