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

时间:2014-06-26 09:29:19

标签: mysql sql mysqli

请帮助我解决此错误。

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 个答案:

答案 0 :(得分: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