Join a table on itself vs. to itself?
-
09-10-2019 - |
문제
Not extremely significant... but I've gotten a bit curious: What's the correct terminology for a self-join - do you join a table on itself, or join a table to itself?
해결책
You join it to itself, on the fields being joined.
다른 팁
You're likely to get various answers since I'm not sure there's a "standard" per se, but I think SELF JOIN
is pretty common, not to mention self-explanatory. And yes, you join it TO itself.
I would say you join a table to itself
I would only use on to refer to the fields being joined
I am gonna go all mavericky and say WITH
. But, since JOIN is itself a verb, you do not need anything more than that:
TableA joins TableA
SELECT A.FIELD, B.FIELD
FROM MYTABLE A, MYTABLE B
WHERE A.PK = B.FK
제휴하지 않습니다 StackOverflow