I have this table in my datatbase
"CREATE TABLE \(tableNAME) ("
+ " GameID Integer,"
+ " TimesPlayed Integer Default 0,"
+ " TimesWon Integer Default 0,"
+ " isFavorite Boolean Default False)"
currently only TWO records have isFavorite marked as true, ALL values of TimesPlayed and Times Won are ZERO
SELECT a.gameid,a.gametitle,a.iconname, IFNULL(b.isFavorite,false) as isFavorite, IFNULL(b.timesPlayed,0) as timesPlayed, IFNULL(b.timesWon,0) as timesWon
FROM Lookup a
LEFT JOIN Favorites b
ON a.gameID=b.gameID
ORDER BY a.gameTitle
This query returns ALL records in “lookup” as required (there is no “WHERE”)
Adding this to the above gives me the two marked Favorites
WHERE isFavorite=true
however so does using this as the WHERE
WHERE timesPlayed=0
It should return ALL records as everyone has timesPlayed as ZERO, not just the two favorites
This final WHERE returns the correct values (ie. ZERO records)
WHERE timesPlayed>0
So >0 returns no records (correct) but =0 return only TWO?
FYI… I have validated that the values of every field is correct