I have a problem with my query and mysql throws the following error:
#1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'a.item_name' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
QUERY:
SELECT a.item_name,a.discounted_price,
SUM(qty) as total,
b.date_created
FROM
mt_view_order_details as a
left join mt_order as b
ON
a.order_id=b.order_id
WHERE
b.date_created BETWEEN '2021-07-03 00:00:00' AND '2021-08-02 23:00:59'
AND a.merchant_id = '3'
AND a.status NOT IN ('initial_order')
GROUP BY item_id
ORDER BY item_name ASC
I'm using a shared hosting, so i can't change sql_mode, please tell me is there any other solution, Thanks in advance