Question

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?

Was it helpful?

Solution

You join it to itself, on the fields being joined.

OTHER TIPS

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top