Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
bkbinani
Starting Member
15 Posts |
Posted - 2012-01-17 : 01:02:05
|
Plz correct the following SQL command (MS-SQL2005)--Mst_led --> Parent Table--Mst_Adrs --> Child Table--To Do -> Delete Records from Child Table which r not in parent Table--Connections -> MST_LED.CLED_CODE = Mst_adrs.cled_iddelete mst_adrs where not Exists(select * from mst_adrs join mst_led on mst_adrs.cled_id = mst_led.cled_code)The above command show 0 records deletedPlease Help |
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2012-01-17 : 07:31:12
|
a) practice with a SQL SELECT statement first, identifying the data you want to delete.b) then turn the SELECT into a DELETE and action.c) the style of query below has the benefit of suiting both of the above objectivesdelete afrom aleft join b on b.id = a.idwhere b.id is null |
 |
|
bkbinani
Starting Member
15 Posts |
Posted - 2012-01-20 : 00:40:40
|
Thanx Sir.I m poor in SQL. Your Reply was very Simple but PERFECT and nice.It gave me a way to proceed ahead. Many Many Thanx. |
 |
|
|
|
|