Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

duplicates

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
VBdotnet2005
Asked:
VBdotnet2005
  • 2
3 Solutions
 
Rajkumar GsSoftware EngineerCommented:
If there are more records in table2 or table3 for a record in table1, INNER JOIN will return all the records
0
 
Rajkumar GsSoftware EngineerCommented:
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
 
CboudrozCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now