When I perform join operation on two tables, I get too many rows than actually it should appear.
How do I fix it ?
If anyone knows any solution or alternative to this.... then please suggest.
When I perform join operation on two tables, I get too many rows than actually it should appear.
How do I fix it ?
If anyone knows any solution or alternative to this.... then please suggest.
When you join tables, make sure that the number of join predicates in the search condition is one less than the number of tables in the from list. Otherwise, you will get many more rows returned than you probably intended.
The problem you are facing(extra rows) is called a Cartesian product.
You basically asked for a combination of every value from one table matched to every value from the other table. In your case you did have an "except"-type condition so you eliminated a few of the matches.
Let me explain it this way:
Imagine you have two identical lists of names.
Each list is 200 names long and there are no duplicates within the list.
The query you just wrote would combine each of the first 200 names with
each one of the other 199 names from the other table that didn't match so
that your final results would be (200x199) or 39800 records, way more than
the 400 you started with.....
Bookmarks