[mysql]#1066-不是唯一的表别名: 'tbl_loan'

标签: sql MySQL
发布时间: 2017/1/9 22:01:22
注意事项: 本文中文内容可能为机器翻译,如要查看英文原文请点击上面连接.

请帮我得到这个错误此查询。

1066-不是唯一的表别名: 'tbl_loan'

   SELECT tbl_customer.*,tbl_branch.*,tbl_loan.* 
     FROM tbl_customer
LEFT JOIN tbl_branch 
       ON tbl_branch.id = tbl_customer.cust_branch, tbl_loan
LEFT JOIN tbl_loan 
       ON tbl_loan.cust_id = tbl_customer.id
    WHERE tbl_customer.cust_branch='1' 
      AND tbl_loan.status = 0 
 ORDER BY tbl_customer.id DESC

解决方法 1:

你有一个额外的 , 在查询中,试试这个︰

select  `tbl_customer`.*, `tbl_branch`.*, `tbl_loan`.* 
from `tbl_customer` 
left join `tbl_branch` 
on `tbl_branch`.id=`tbl_customer`.cust_branch 
left join `tbl_loan` 
on `tbl_loan`.cust_id=`tbl_customer`.id
where `tbl_customer`.cust_branch='1' 
and `tbl_loan`.status=0 
ORDER BY tbl_customer.id DESC
赞助商