我有一个用例,想获取用户前一天所做的最新交易,
如果今天是2019年6月26日,
我想去拿
the last transaction made by the user on 25th June 2019 at 23:59:59
我的数据是这样的-
我不擅长sql并尝试了以下查询-
SELECT MAX(transaction_id), user_id, MAX(created_date), new_balance
FROM transaction
where created_date < 1561507199
GROUP BY user_id;
我得到以下错误-
Error Code: 1055. Expression #4 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'transaction.new_balance' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by