About this question
My SQL statement returns properly on my laptop's MySQL (Server version: 5.5.62-0ubuntu0.14.04.1 - (Ubuntu)) but on my server (Server version: 5.7.26-0ubuntu0.16.04.1 - (Ubuntu)) it returns an error.
SELECT * FROM `orders` WHERE `mail_sent`='No' AND `datetime` < DATE_SUB(NOW(), INTERVAL 15 MINUTE) GROUP BY `contact_id` ORDER BY `datetime` ASC;
1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'shop.orders.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by