I'm trying to figure out the best query to accomplish the following.

I have 2 tables that are related by an ID column.

Table1

```
ID
UserID

```

Table2

```
ID
SomeDataColumn

```

What I need to do is select a list of IDs from `Table1` where my `UserID='5'` or some number. This should return multiple rows with respective IDs. Then I need to delete all rows from `Table2` that contain any ID from my returned list of IDs from `Table1`.

The only way I could figure out how to do this was to select all of the rows from my first table, put them in a cursor, and then loop through each one running a Delete query for each ID. But it seems there must be a more efficient way to do this with a join or something.

Any ideas? Thanks all!