I am very new to the mysql part, i have one table which contains multiple columns from that i want to check two columns if column1 is greater than column2 it should subtract column1-column2(amount-amount_refunded) and it store as a amount which will not effect any current functionality can you please help me to acheive this thing..
what i am trying is
SELECT
IF((amount > amount_refunded),amount-amount_refunded ,IFNULL(sum(amount), 0)) AS amount,
//remaining query
error i got
SQL Error [1055] [42000]: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'loach.charges.amount' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by