add tag
Anonymous 2218
There is "id_change_history" table and a "source" table.
id_change_history table hold information about what changed to what(basically, old_id & new_id).
source table hold information about ids currently in use.

id_change_history:
```
old_id	| new_id
x1		|x2
x2		|x3
x3		|x4
y1		|y2
y2		|y3
z1		|z2
```
source:
```
id_in_use
x1
x4
y3
z1
a1
```
Prefixes x, y, z & a are used here to make data more readable. Actual Ids are not prefixed.

We want to delete all older records from id_change_history table where Ids aren't in use. However, we also want to retain ids which falls under range of ids being used.
So, In above data example we need to delete only y1, y2 & z2.

Any help is highly appreciated. Thank you!.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.