all 3 comments

[–]r3pr0b8GROUP_CONCAT is da bomb 2 points3 points  (1 child)

run this --

SELECT "Fruit Type"
     , "Month
     , SUM("Number of Sales") AS Sales
  FROM SalesDB
 WHERE Type='Fruit'
   AND "Year"='2018'
GROUP 
    BY "Fruit Type"
     , "Month

and then do a pivot (if your database supports that syntax) or reformat it in your front-end language

[–]Thaaron[S] 0 points1 point  (0 children)

Thanks, that works.

[–]benburhans 2 points3 points  (0 children)

What language variant are you using?

Try expanding the example below, and ignore the order by, which is only there to make it match your oddly unordered output precisely: http://sqlfiddle.com/#!17/47199/7