Discussion Locked

RECORD DUPLICATION

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

dear All,
now i am using sql server for database for my application.while I am using a query it give multiple records.I double checked with query analyser but no impact. please help..
the query:
"select domains.domainid,domains.dvendor,domains.dexpirydate,domains.wspace,domains.wexpirydate, clients.organisation, enquiry.dateoffollowup from domains inner join clients on domains.organisation=domains.organisation inner join enquiry on clients.organisation=enquiry.organisation order by enquiry.enquiryid "

I tried with another one
2)'rs.Open "select domains.domainid,domains.dvendor,domains.dexpirydate,domains.wspace,domains.wexpirydate,clients.organisation,enquiry.dateoffollowup from domains inner join clients on domains.organisation=domains.organisation inner join enquiry on clients.organisation=enquiry.organisation order by enquiry.enquiryid "

any one have idea?
Thanks in advance
melvin

4 replies

by medievaldude

There must be some other distinct fields in those tables besides what you are selecting. A simple fix is to use SELECT DISTINCT in your query.

by melvinroy1978

Thank you mr.medivialnude.
I already tried with this "distinct" .while i am using with distinct,there is no need for using "order by".The duplication again occuring in both query analyser and the application.

error:"order by items must appear in the select list if select distinct is specified"

any one have any idea pls help
melvin

by tony hopkinson

join clients on domains.organisation=domains.organisation
Shouldn't this be
domains.organisation=clients.organisation
?

by amolj

As far as distinct concern,
create View of any of above quey.
Apply Order By to view. so no problem with order by and distinct

--------------------------------------------
select * from ViewName Order By Filedname
--------------------------------------------

This discussion is closed to new replies.