I can't make GROUP_CONCAT make ORDER BY.
SELECT GROUP_CONCAT(`cdlAmountA`+`cdlAmountB`+`cdlAmountC` SEPARATOR "|")
FROM `creditlogs`
WHERE `cdlDate` = "2016-04-07"
AND compID = "AIR"
ORDER BY `creditID`
This is out put.
96276.9|7960.2|0|0
But it's not right, The right answer is.
0|96276.9|7960.2|0
How can i make it right. And this is database.
creditID | cdlAmountA | cdlAmountB | cdlAmountC
-----------------------------------------------
1 | 0 | 0 | 0
2 | 34948.7 | 61328.2 | 0
3 | 4510.2 | 3450 | 0
4 | 0 | 0 | 0
The ORDER BY
clause has to be used inside GROUP_CONCAT
function like this:
SELECT GROUP_CONCAT(`cdlAmountA`+`cdlAmountB`+`cdlAmountC`
ORDER BY `creditID` SEPARATOR "|" )
FROM `creditlogs`
WHERE `cdlDate` = "2016-04-07" AND compID = "AIR"
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments