How can i run a Delete Statement from the following Query
-
Good Morning All u have the Following Query that Display me the records.
select ps.Lis_key as [Celeste],p.Lis_key as [Pro-v], p.Attrib_code,p.Func_key from dbo.Check_LIS ps inner join Tshwane_Valuations.sde.Property p on ps.Lis_key = p.Lis_key where ps.Lis_key = p.Lis_key And Substring(p.Attrib_code,5,2)='16' OR p.Attrib_code = '0009000900'
so i want Delete the records returned by this Query. please Explain how you do it when you give me a code. ThanksVuyiswa Maseko, Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding VB.NET/SQL7/2000/2005 http://vuyiswamb.007ihost.com http://Ecadre.007ihost.com vuyiswam@tshwane.gov.za
-
Good Morning All u have the Following Query that Display me the records.
select ps.Lis_key as [Celeste],p.Lis_key as [Pro-v], p.Attrib_code,p.Func_key from dbo.Check_LIS ps inner join Tshwane_Valuations.sde.Property p on ps.Lis_key = p.Lis_key where ps.Lis_key = p.Lis_key And Substring(p.Attrib_code,5,2)='16' OR p.Attrib_code = '0009000900'
so i want Delete the records returned by this Query. please Explain how you do it when you give me a code. ThanksVuyiswa Maseko, Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding VB.NET/SQL7/2000/2005 http://vuyiswamb.007ihost.com http://Ecadre.007ihost.com vuyiswam@tshwane.gov.za
Why don't you try this: delete from dbo.Check_LIS where Lis_key in( select ps.Lis_key from dbo.Check_LIS as ps inner join Tshwane_Valuations.sde.Property as p on ps.Lis_key = p.Lis_key where substring (p.Attrib_code, 5, 2) = '16' or p.Attrib_code = '0009000900' ) Also you don't need to add ps.Lis_key = p.Lis_key in the where clause since you use inner join on the same fields. I hope this was helpful. Best wishes, Dobromir.
-
Why don't you try this: delete from dbo.Check_LIS where Lis_key in( select ps.Lis_key from dbo.Check_LIS as ps inner join Tshwane_Valuations.sde.Property as p on ps.Lis_key = p.Lis_key where substring (p.Attrib_code, 5, 2) = '16' or p.Attrib_code = '0009000900' ) Also you don't need to add ps.Lis_key = p.Lis_key in the where clause since you use inner join on the same fields. I hope this was helpful. Best wishes, Dobromir.
Thanks man it was very easy Thanks
Vuyiswa Maseko, Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding VB.NET/SQL7/2000/2005 http://vuyiswamb.007ihost.com http://Ecadre.007ihost.com vuyiswam@tshwane.gov.za