I wanted to ask about the condition of an ON
clause while joining tables:
SELECT c_User.ID
FROM c_User
WHERE EXISTS (
SELECT *
FROM c_Group
JOIN c_Member ON (c_Group.Group_Name LIKE 'mcp%')
WHERE
c_Group.Name = c_Member.Parent_Name
AND c_Member.Child_Name = c_User.Lower_User_Name
)
I know that tables c_Member
and c_Group
have one column with the same name, Directory_ID
. What I expected was c_Member
and c_Group
to join on that column using something like:
c_Group JOIN c_Member ON (c_Group.Directory_ID = c_Member.Directory_ID)
WHERE c_Group.Group_Name like 'mcp%'
How is this condition able to match the rows?
c_Member ON (c_Group.Group_Name LIKE 'mcp%')
- Is this is a shorter way of referring to two tables joining on a column with the same name, while applying the LIKE condition?
- If so, then can such a style work for a table with multiple column names that are the same?