所以我有这个问题,我试图这样解决:
select account.account_number,account.balance loan.loan_number,loan.amount from account LEFT JOIN loan ON account.branch_name=loan.branch_name';
我的表格如下: table1:account,table2:loan。 让我感到这个错误。
ERROR 1064 (42000): You have an error in
your SQL syntax; check the manual that
corresponds to your MySQL server version
for the right syntax to use near '';
select
account.account_number,account.balance
loan.loan_number,loan.amount f' at line1
老实说我根本没有得到它,所以如果有人可以向我解释如何解决它,我将很感激。 查找每个分支机构在帐户中的总金额。 我有以下这些表格:tables 请帮忙,谢谢你。
答案 0 :(得分:1)
select account.account_number,
account.balance, --you missed one comma there
loan.loan_number,
loan.amount
FROM account
LEFT JOIN loan
ON account.branch_name=loan.branch_name; -- you had a extra single quote there
格式良好的代码将帮助您发现问题。