我有这个查询
Update loans set fine = case
when DATEDIFF((
(SELECT * from (SELECT loans.due_date FROM loans where users_id = 1) AS l1))
,DATE(NOW())) > 0 THEN 1
ELSE fine
END
WHERE users_id =1;
从表
+-------------+
| Field |
+-------------+
| users_id |
| books_isbn |
| aquire_date |
| due_date |
| fine |
+-------------+
它适用于只有一个“贷款”的用户,但我不知道如何使其适用于一个用户的多个“贷款”。=(