我尝试连接三个表,然后将一个表过滤到每个用户的最新条目。但是,我突然遇到了错误promise
。我需要加入这个"复制"柱。我该如何解决这个问题?
.then
答案 0 :(得分:2)
在*
中,您有两列username
。您需要限定其中一个或两个。示例如下:
SELECT
customers.id,customers.name,customers.username,customers.phone,customers.email,radcheck.value as password
FROM customers
RIGHT JOIN radcheck ON customers.username = radcheck.username
LEFT JOIN (
SELECT radrecent.username, latest FROM radacct INNER JOIN (
--^^^^^^^^^
SELECT username,MAX(acctupdatetime) AS latest FROM radacct GROUP BY username
) as radrecent
ON radacct.username = radrecent.username
AND radacct.acctupdatetime = radrecent.latest
) as radlatest
ON customers.username = radlatest.username
WHERE radcheck.attribute = 'Cleartext-Password'