我正在看这个旧的SQL查询。我无法得到的一点是为什么它在同一列上两次内部连接同一表。我说的是Table1和Table1,别名为“ Table1Alias”,
SELECT DISTINCT othercolumns,
Table1Alias.columna
FROM maintable
INNER JOIN secondarytable
ON maintable.id1 = secondarytable.a_id1
INNER JOIN table1
ON secondarytable.id2 = table1.id3
INNER JOIN table1 Table1Alias
ON secondarytable.id2 = Table1Alias.id3
INNER JOIN thirdtable
ON table1.id4 = thirdtable.id5
INNER JOIN fourthtable
ON thirdtable.id6 = fourthtable.id7
INNER JOIN fivetable
ON thirdtable.id8 = fivetable.id9
INNER JOIN sixthtable
ON Table1Alias.columna = sixthtable.id10
LEFT JOIN seventhtable
ON thirdtable.id11 = seventhtable.id12
WHERE LEFT(secondarytable.type123, 2) BETWEEN '01' AND '09'
AND secondarytable.type456 = 'cate'
AND table1.type = '0'
AND Table1Alias.columna = 'conn'
自我加入的目的是什么?(英语)
—
philipxy