Query 1 ERROR: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'ver.stock_delivery.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
SELECT
*,
SUM(remainder) AS sum
FROM
stock_delivery
GROUP BY
product_id;
SELECT
stock_delivery.id,
stock_delivery.auto_id,
stock_delivery.stock_id,
stock_delivery.product_id,
stock_delivery.quantity,
remainder.remainder_count
FROM
stock_delivery
LEFT JOIN (
SELECT
product_id,
sum(remainder) AS remainder_count
FROM
stock_delivery) AS remainder ON remainder.product_id = stock_delivery.product_id
GROUP BY
stock_delivery.product_id