I ran into a problem today. I got a table with coins values :
0.01
0.01
0.01
0.05
0.10
0.25
1.00
1.00
2.00
and so on...
So the main idea is to get all the value one time so 0.01, 0.05, etc..
So I do :
SELECT Valeur FROM Mint_Coins GROUP BY Valeur
Now it will give me one row for each value… I want all values in one row so I use this :
SELECT GROUP_CONCAT(',', Valeur) AS Values FROM Mint_Coins GROUP BY Valeur
It give me again 7 rows in blob… to have blob it mean that the row are over 512 bytes… Okay, let’s see when I convert that they contain… results is now :
0.01, 0.01, 0.01, 0.01
0.05, 0.05
etc..
So what I am doing wrong ? I want the result to hold in one colomn and one row like this 0.01,0.05,0.10,0.25,1.00,2.00.
Thanks
You can pass distinct to group_concat to ignore duplicated values:
You also don’t need to group by in this case.
If you wanted the results in multiple rows, you could also have done: