Click here to Skip to main content
15,744,193 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,
I have a data as below:

Table

country     date                value       
------------------------------------------------------
test1       5/1/2008            500
test1       5/7/2008            200 
test1       5/8/2008            300
test1       7/1/2008            100
test1       7/2/2008            100
test2       6/1/2008            100

And I want a result as below:

Result
-----------
countryName          May-08         Jun-08      July-08
test1                1000             -          200
test2                 -              100 



How can I create a month name as a column name for a given date range in mysql?

[edit]Code block added - OriginalGriff[/edit]
Posted
Updated 25-Mar-18 23:21pm
v2

 
Share this answer
 
country date value
------------------------------------------------------
test1 5/1/2008 500
test1 5/7/2008 200
test1 5/8/2008 300
test1 7/1/2008 100
test1 7/2/2008 100
test2 6/1/2008 100


may sql query send

countryName May-08 Jun-08 July-08
test1 1000 - 200
test2 - 100
 
Share this answer
 
v2
Comments
Richard Deeming 27-Mar-18 9:42am    
4½ YEARS too late! And not even an attempt to answer the question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900