Jump to content

Crosstab column names


Sako

Recommended Posts

Hi,

 

I am looking for a way to do a crosstab. I've read plenty of articles on mySQL "crosstabs", but I still haven't found one that suits my needs.

 

Here is my table:

 

Ticker - Date - Field1

MSFT - 20110325 - 1

MSFT - 20110322 - 0

CSCO - 20110325 - 1

CSCO - 20110322 - 1

 

I want the format below as a result:

 

20110325 -  20110322

MSFT - CSCO

CSCO -

 

Basically, if Field1 is 1, then show the ticker. The hardest part is how would I name the column name as the date instead of manually writing

 

"select ... As 20110325 ..."

 

Any help?

 

Link to comment
https://forums.phpfreaks.com/topic/231864-crosstab-column-names/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.