Hi All,
I have a table called Test.
It has the following fields all with nvarchar data type.
ZoneID, ProdID, ProdDesc
Now, apart from different zoneids, there is a id called GOLBAL
Irrespective of zoneid, I want to update the descripiton to same as the GLOBAL level description.
Here's what I need to do.
1. Get a list (lets say ListA) of distinct ZoneID, ProdID, ProdDesc where ZoneID is GLOBAL
2. Get a list (lets say ListB) of distinct ZoneID, ProdID, ProdDesc where ZoneID is not global
3. Compare ListA & ListB, set all the ProdDesc of ListB to same as the ProdDesc of ProdListB, where ProdID in both ListA & ListB is same, but ProdDesc in both ListA & ListB is different.
I can write the queries for step 1 & 2.
1.
select distinct distinct ZoneID, ProdID, ProdDesc into ListA from Test where ZonID='GLOBAL'
2.select distinct distinct ZoneID, ProdID, ProdDesc into ListB from Test where ZonID<>'GLOBAL'
3.
???
Can some help me here to write a update query, using the critiera in step3 (defined above).
Looking for a quick response.
Thanks
I have a table called Test.
It has the following fields all with nvarchar data type.
ZoneID, ProdID, ProdDesc
Now, apart from different zoneids, there is a id called GOLBAL
Irrespective of zoneid, I want to update the descripiton to same as the GLOBAL level description.
Here's what I need to do.
1. Get a list (lets say ListA) of distinct ZoneID, ProdID, ProdDesc where ZoneID is GLOBAL
2. Get a list (lets say ListB) of distinct ZoneID, ProdID, ProdDesc where ZoneID is not global
3. Compare ListA & ListB, set all the ProdDesc of ListB to same as the ProdDesc of ProdListB, where ProdID in both ListA & ListB is same, but ProdDesc in both ListA & ListB is different.
I can write the queries for step 1 & 2.
1.
select distinct distinct ZoneID, ProdID, ProdDesc into ListA from Test where ZonID='GLOBAL'
2.select distinct distinct ZoneID, ProdID, ProdDesc into ListB from Test where ZonID<>'GLOBAL'
3.
???
Can some help me here to write a update query, using the critiera in step3 (defined above).
Looking for a quick response.
Thanks