I'm trying to transpose a very basic output for use in a web application. As my strengths lie moreso in mysql, I'd like to this before it hits the app.
What I currently have is:
date value
2012-01-01 23
2012-01-02 33
2012-01-03 56
2012-01-04 10
What I want is:
2012-01-01 2012-01-02 2012-01-03 2012-01-04
23 33 56 10
My sql is:
SELECT
date,
value
from values
where date >= curdate() - interval 3 day
I've done a ton of research online and I can't figure out a good way to do this. This would need to be dynamic as the dates do change daily.
Here's a dynamic sql to pivot records,