I made a queiry. but every data show in this queiry double. I mean every data show two time in this queiry. why this problem occured. any body help me please.

Recommended Answers

All 10 Replies

use distinct

select distinct vFirstName from User

where vFirstName is the attribute/field and User is the table name

This may also happen with a JOIN query in a PARENT/CHILD relationship. For every record in child that matches parent, parent will show a record. If not using a join query see post above.


Good Luck

i could help you if you could just post your project here along with the database...

please check it.

Okay, the reason you are getting the results you are getting is because there is no unique identifier that relates the two tables together and you have no selection criteria.

Table1
iNameID AutoNumber
vName (BTW NAME is a keyword that can cause confusion)
iRoll Number

Table2
iClassID AutoNumber
iNameID Number Foreign Key
vClass (BTW Class VBA Keyword)
dDate (BTW Date KeyWord)


Good Luck

Table2
iNameID Number Foreign Key

here foreign key mean............? please explain

here foreign key mean............? please explain

Table1
iNameID AutoNumber
vName (BTW NAME is a keyword that can cause confusion)
iRoll Number

Table2
iClassID AutoNumber
iNameID Number Foreign Key
vClass (BTW Class VBA Keyword)
dDate (BTW Date KeyWord)

Foreign Key means that it has a relationship with the primary key or the iNameID in Table1 is the same as iNameID in Table2...

( I hope i didnt make a mistake.. :D LOL )

No, you got it right...

tblAddress
iAddID
vStNo
vStName
vCity
vSt
vZip

1, 123, Street A, SomeCity, SomeState, 12345
2, 234, Street B, SomeCity, SomeState, 23456

tblName
iNameID
iAddID
vFName
vLName

1, 1, Jane, Doe
2, 1, John, Doe
3, 1, John, Doe Jr.

In this example the Doe's all live at the first address hence the one to many relationship identified by the foreign key


Good Luck

Ok. vb5prgrmr. you mean they need a relationship. If i make a primary key both table then I think It will solve.

I have checked your tables.

I found that there is no relationships between the table. So this result is expected.

You need to create a primary key field in the table1 (lets say name column is primary key)

Now you need to create a corresponding foriegn key column in the table2 (add a column lled name - with same values)

Now make a relationship between table1 to table2 on column 'Name' as primary key in table1 and foriegn key in table2.

Now your query will not show duplicate records.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.