Hi. Sql Server.
I have a list of keys (nvarchar) where I need to delete records from 2 tables according to these keys.
I can't delete a Dad record until all its childrens are deleted....
simplification :
delete c from child c join dad d on d.id = c.dadId where d.name in( 'x','y','z')
and then
delete dad d where d.name in( 'x','y','z')
but I really hate to write ` in( 'x','y','z')` twice.
I know I can use dynamic SQL . but is it possible to combine those 2 queries into one usinc CTE or something ?