0

I have this alasql query I need to count a total, then if the row has a bool that is true, to count those ones. However, for whatever reason it just counts all the rows including the ones that are false.

var groupedShipDatesAndCabinetCounts = alasql("SELECT ShipDate, SUM(CabinetCount) AS TotalCabinetCount, SUM(CASE WHEN ShipDateConfirmed IS 1 THEN CabinetCount ELSE 0 END) AS LessCabinetCount FROM ? GROUP BY ShipDate", [shipData.TotalShipDatesAndCabinetCounts]);

What do I need to do to get this query working properly? I double check the data and it is all getting to this point as expected.

Thanks in advance

DalTron
  • 939
  • 3
  • 9
  • 22
  • I don't use `alasql`, but does `ShipDateConfirmed IS 1` work for you? Should it not be `=` instead? – sgeddes Jun 05 '18 at 21:57
  • I ended up finding the answer. I went back to where my data was coming in and changed it there. The = sign didn't work and I had to use IS for anything to work. – DalTron Jun 06 '18 at 13:43

0 Answers0