Join table question
Sometimes JOINS can be confusing. What's the difference with the two queries below? Why it will bring different results?
left join PK2 ON PK2.PNN = PK1.PNN AND PK2.MANT = PK1.MANT";
left join MSS ON dbo.MSS.RSM = PK2.GBT AND dbo.MSS.MANT = PK2.MANT
left join PK2 ON PK2.GBT = MSS.RSM AND MSS.MANT = PK2.MANT
left join PK1 ON PK1.PNN = PK2.PNN AND PK1.MANT = PK2.MANT
Because you are using left joins, each query will return every row of the "from" table regardless of the existence of any matches in the left-joined tables (returning null for any such fields where there are no joins). Since the "from" table is different in each query, you would get different results (unless there is at least one join-able row in each table for each row in the other tables).
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)