I am trying to wrap my head around creating a delete statement for a table with a composite key.
I would like to create something like:
DELETE
FROM
table_example1
WHERE
COLUMN1, COLUMN2
IN
(SELECT COLUMN1, COLUMN2 FROM table_example2
WHERE
COLUMN_DATETIME > @Period);
Keeping in mind only the combination of COLUMN1 and COLUMN2 is unique, each column on its own is not unique.
I can't seem to get my head around how I would actually do this.
where (COLUMN1, COLUMN2) IN (...)but I don't think SQL server supports this. – May 07 '15 at 09:18