How to write query to Delete the records in child table
and corresponding records in parent table

Answer Posted / zackziss

delete from c from child c inner join parent
on c.childid = parentid

Is This Answer Correct ?    2 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between createstatement and preparedstatement?

687


How to enter date and time literals in ms sql server?

677


What is the difference between grant and with grant while giving permissions to the user?

726


How to use wildcard characters in like operations in ms sql server?

800


What is the importance of concurrency control?

959






How to rename databases in ms sql server?

814


How to replace null values in expressions using isnull()?

840


What is the purpose of optimization?

720


What is a result set object returned by mssql_query()?

733


I applied Transactional with updatable subscriptions replication on 2 tables now i want to delete those 2 tables but i cannot delete those tables as replication is running how can i stop replication for those 2 tables(but i don't want to delete those replicated tables but i need to stop the replication) how can i do that

1647


List some major differences between triggers and stored procedures?

685


What purpose does the model database server?

849


How to add additional conditions in SQL?

765


what exactly sql injuction.how to overcome.....

2235


Explain different types of lock modes in sql server 2000?

681