使用left join列出帐号、余额、贷款号码和金额地址

idfiyjo8  于 2021-06-18  发布在  Mysql
关注(0)|答案(1)|浏览(282)

所以我有一个问题,我试着这样解决:

select account.account_number,account.balance loan.loan_number,loan.amount from account LEFT JOIN loan ON account.branch_name=loan.branch_name';

我的表格如下:表1:账户,表2:贷款。它告诉我这个错误。

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

而这一次我真的没有得到它,所以如果有人能解释给我如何解决它,我会很感激。找出每个分行在账户中的总金额。我把这些table当作follows:tables please 帮帮忙,谢谢。

kiz8lqtg

kiz8lqtg1#

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

一个好的格式化代码将帮助您找到问题。

相关问题