3
Reply

sql query for duplicate records

Mani Kandan

Mani Kandan

Jun 10 2016 9:28 AM
349
Hello Sir,
 
I am stuck with a problem, Here is master(Tble_MainData) table contain company name, brand name, item name. But I want list of MasterID,companyid,brandid,itemid as same shown in the matertable's each record instead of names, using select query that below mentioned
'
(if there is mistake in select query please current it) and also i have attached herewith 4 tables with data script.
 
select distinct(Tble_MainData.ID),ProductCompany.Id as CompanyID,Brands.Id as BrandID, Items.Id as ItemID from Tble_MainData
inner join Brands on Tble_MainData.Brand = Brands.BrandName
inner join Items on Tble_MainData.Item = Items.ItemName
inner join ProductCompany on Tble_MainData.Company = ProductCompany.CompanyName
 
Kindly replay me.
Thanks.

Attachment: DB_4_Tables.zip

Answers (3)