Error in count items query! SELECT count(*) as itemNum FROM leonardo_flights,leonardo_waypoints WHERE (1=1) AND DATE_FORMAT(DATE,'%Y%m') = 201807 AND ( excludeFrom & 1 ) = 0 AND userID>0 AND (private=0 OR private=4 ) AND leonardo_flights.takeoffID=leonardo_waypoints.ID AND leonardo_waypoints.countryCode='FR'