Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

duplicates

Posted on 2011-02-11
3
255 Views
Last Modified: 2012-05-11
I have three sample tables. All there has id field.
Why does it return duplicates accounts?


select a.field1, b.field1, c.field2
from table1 a
inner join table2 b
on a.id = b.id
inner join table3 c
on a.id = c.id
0
Comment
Question by:VBdotnet2005
  • 2
3 Comments
 
LVL 23

Assisted Solution

by:Rajkumar Gs
Rajkumar Gs earned 83 total points
ID: 34873770
If there are more records in table2 or table3 for a record in table1, INNER JOIN will return all the records
0
 
LVL 23

Accepted Solution

by:
Rajkumar Gs earned 83 total points
ID: 34873796
For eg:-
If table1 have 1 record.
table2 have related 5 records
then INNER JOIN will return 5 records

Hope you are clear
Raj
0
 
LVL 7

Assisted Solution

by:Cboudroz
Cboudroz earned 42 total points
ID: 34874064
because the id field is probably unique in each database or you don't have correct ON clause.

example:

 
select 
	*
from 
	employes e
	inner join function f
		on e.employe_id = f.employe_id 
where 
	e.employe_id = 1

Open in new window



you will have two row for same employe if the employe got two different function in the compagnie.

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question