Click here to Skip to main content
14,774,347 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
select mt.MachinaryType, md.MachinaryName, md.Model, md.CountryOrRegion, md.WarrentyPeriod, md.PriceBDT,
                        d. DeptName, c.CompanyName, mp.MaintencePlanType, em.EmpCode, em.EmpName
                        from tblMachinaryDetails md
                        inner join tblMachinaryType mt on md.MTCode=mt.MTCode
                        inner join tblCompanyWiseMachine cm on cm.CMCode=md.CMCode
                        inner join tblDepartment d on d.DeptCode=cm.DeptCode
                        inner join tblCompany c on c.CompanyCode=cm.CompanyCode
                        inner join tblMaintencePlanEntry mp on mp.MDCode=md.MDCode
                        inner join tblDailyMaintenceDetails dm on dm.MDCode=md.MDCode
                        inner join tblEmployeeInformation em on em.EmpCode=dm.EmpCode
                        where md.MDCode='MDP-000001'


This query results the following :

Generator Toshiba T001 China 1 Year 250000.00 IT Birds Garments Ltd. Monthly 010100001 HASNA BEGUM
Generator Toshiba T001 China 1 Year 250000.00 IT Birds Garments Ltd. Monthly 010100001 HASNA BEGUM


How can I prevent the data duplication. If I use distinct then it show only one Row. I do not want to use distinct keyword
Posted
Updated 7-May-13 2:44am
v2
Comments
Sandeep Mewara 7-May-13 7:46am
   
If you don't want to use DISTINCT then what is you want to do?

Make sure that duplicate data is not inserted.
Sumon562 7-May-13 7:49am
   
I want to prevent data duplication without using distinct. Can you explain what is better for me?
Johnny J. 7-May-13 8:40am
   
WHY don't you want to use DISTINCT. It does exactly what you're asking about, and that's what it's made for...

1 solution

use distinct
select DISTINCT mt.MachinaryType, md.MachinaryName, md.Model, md.CountryOrRegion, md.WarrentyPeriod, md.PriceBDT,
                        d. DeptName, c.CompanyName, mp.MaintencePlanType, em.EmpCode, em.EmpName
                        from tblMachinaryDetails md
                        inner join tblMachinaryType mt on md.MTCode=mt.MTCode
                        inner join tblCompanyWiseMachine cm on cm.CMCode=md.CMCode
                        inner join tblDepartment d on d.DeptCode=cm.DeptCode
                        inner join tblCompany c on c.CompanyCode=cm.CompanyCode
                        inner join tblMaintencePlanEntry mp on mp.MDCode=md.MDCode
                        inner join tblDailyMaintenceDetails dm on dm.MDCode=md.MDCode
                        inner join tblEmployeeInformation em on em.EmpCode=dm.EmpCode
                        where md.MDCode='MDP-000001'

Happy Coding!
:)
   
Comments
Sumon562 7-May-13 22:27pm
   
Thank you Mr. Aarti Meswania
Aarti Meswania 8-May-13 0:26am
   
I am girl
Welcome!
Glad to help you! :)
Aarti Meswania 8-May-13 0:28am
   
Do you have downvote my answer?
rating below 3 star is called downvote.
so, if anwer work for you then you should upvote / "Accept Solution" :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900