|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Too many rows after Join in SQL 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. |
#2
| |||
| |||
Re: Too many rows after Join in SQL 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. |
#3
| |||
| |||
Re: Too many rows after Join in SQL 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..... |
![]() |
|
Tags: join, sql |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can?t join friends in Max Payne 3, error "Join Failed Failure: Blacklisted. | G.Kahli | Video Games | 3 | 02-06-2012 12:44 PM |
Replace Duplicate Rows | ajk79 | Windows Software | 1 | 20-07-2010 11:01 AM |
How to Insert Multiple Rows At Once in PHP | Zeverto | Software Development | 3 | 22-09-2009 03:30 PM |
Merging duplicate names not rows copy rows into new workbook each time VBA Excel 2003 | awkwardsmile | Software Development | 2 | 09-07-2009 08:57 AM |
Equi Join vs Natural Join in SQL | Demetrius | Software Development | 3 | 14-05-2009 12:55 PM |