三表联查,这是我目前写过的最长的sql语句,嗯嗯,果然遇到问题才能让我更快成长,更复杂的语句也有了一些心得了

select sum(amount),sum(card_number) from sy_user inner join sy_admin on sy_user.customer_id=sy_admin.admin_id inner join sy_user_charge_log on sy_user.username=sy_user_charge_log.username where status = 1 and customer_id = 2;

原文地址:https://www.cnblogs.com/lovewyc1314/p/6031622.html