How to check entire table count before delete [message #406589] |
Thu, 04 June 2009 15:09  |
prasad.kshirsagar
Messages: 4 Registered: June 2009 Location: Houston
|
Junior Member |
|
|
Hello
I have a simple doubt
I am deleting records from one table, but before deleting records I want to make sure that count(*) of another table should not be null.
THe query is like
delete from mi000cht00
where (corpnum like 'B%' or
corpnum like 'LC%') and <working_table is not null>;
In this SQL stmt, I want to check <working_table is not null> part.
please help
Thanks
|
|
|
|
|
|
|
|
Re: How to check entire table count before delete [message #406599 is a reply to message #406589] |
Thu, 04 June 2009 17:56   |
prasad.kshirsagar
Messages: 4 Registered: June 2009 Location: Houston
|
Junior Member |
|
|
Ok...Let me try to explain.
I want to delete data from table mi000cht00. Now There is another working table say mi_cht_working, which contains Column 'Corpnum'.
Now while deleting from mi000cht00, I want to add condition WHERE Corpnum of Working table is NULL.
The SQL stmt will be something like this:
delete from mi000cht00
where (corpnum like 'B%' or
corpnum like 'LC%') AND mi_cht_working.Corpnum is not null;
Hope this helps you.
Thanks.
|
|
|
|
|
|