#1066-不是唯一的表格/别名: [英] #1066 - Not unique table/alias:

查看:72
本文介绍了#1066-不是唯一的表格/别名:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

能帮我个忙吗?我有这个SQL查询:

Can you please help me out. I have this SQL query:

SELECT l.url 
FROM (b INNER JOIN links ON b.parent_id = l.id) 
INNER JOIN b ON l.id = b.link 
WHERE l.url LIKE 'http://domain%' LIMIT 0, 30

以某种方式说

#1066 - Not unique table/alias: b

推荐答案

您似乎在同一张表中选择了两次.这些事件中的每一个都需要有自己的别名:

You seem to be selecting from the same table twice. Each of these occurrences needs its own alias:

SELECT
    l.url
FROM
    b as b1 /* <-- */
    INNER JOIN links as l
      ON b1.parent_id = l.id
    INNER JOIN b as b2 /* <-- */
      ON l.id = b2.link
WHERE l.url LIKE 'http://domain%' LIMIT 0, 30

请注意,我还为links表添加了缺少的别名l.

Please note that I also added the missing alias l for the links table.

这篇关于#1066-不是唯一的表格/别名:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆