#1066 - Not unique table/alias:

后端 未结 2 557
别跟我提以往
别跟我提以往 2021-01-16 10:44

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          


        
2条回答
  •  梦毁少年i
    2021-01-16 11:37

    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
    

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

提交回复
热议问题