我将从一个例子开始:
*Table1*
ID
PhoneNumber1
PhoneNumber2
*Table2*
PhoneNumber
SomeOtherField
SELECT *
FROM Table1 t1
INNER JOIN Table2 t2
ON t2.PhoneNumber = t1.PhoneNumber1
INNER JOIN Table2 t3
ON t3.PhoneNumber = t1.PhoneNumber2
-- here is the question how do I call same column which have same name?
-- I want to do a where clause like below:
WHERE SomeOtherField(from first Table2) = SomeOtherField(from second Table2)
示例来自以下问题,但我们提出了不同的问题: What's the best way to join on the same table twice?
答案 0 :(得分:1)
WHERE t2.SomeOtherField = t1.SomeOtherField