select count(*) as cnt, quantity from basket WHERE productid = '8' AND basket_session = '4e318229af73e09b18a02f996f0866e2' 1140 In aggregated query without GROUP BY, expression #2 of SELECT list contains nonaggregated column 'artbarfu_db.basket.quantity'; this is incompatible with sql_mode=only_full_group_by