Reputation: 6555
I have just started a new question to make this a bit more clear.
I have just migrated from MS SQL to MySQL this query worked in MS SQL
This is rstCombinedChartData
Then the result which should have 2 column 'yes' and 'no' with values for some reason on mysql I'm getting just one and itemcolumn false.
As you can see for some reason it's adding up all the results giving 551 where it should be like this:
Yes x
No x
Why?
This is the SQL Query:
SELECT
itemColumn
,SUM(valueColumn) AS valueColumn
,label
FROM
rstCombinedChartData
GROUP BY
label
,itemColumn
ORDER BY
label DESC
,itemColumn DESC
Upvotes: 0
Views: 120
Reputation: 3855
Plase try:
SELECT itemColumn, SUM(CAST(valueColumn AS SIGNED)), label FROM rstCombinedChartData GROUP BY label, itemColumn ORDER BY label DESC, itemColumn DESC
Upvotes: 1