# Active Record Delete if not in

**URL:** <https://www.ruby-forum.com/t/active-record-delete-if-not-in/134415>\
**Category:** Rails\
**Created:** [April 10, 2008, 4:54pm UTC](https://www.ruby-forum.com/t/active-record-delete-if-not-in/134415 "2008-04-10T16:54:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sealedsun](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e68b1a/32.png) [@sealedsun](https://www.ruby-forum.com/u/sealedsun)\
**Post date:** [April 10, 2008, 4:54pm UTC](https://www.ruby-forum.com/t/active-record-delete-if-not-in/134415/1 "2008-04-10T16:54:47Z")

</div>

Hy!

How can i delete from an AR Object the opposite way like the following:

Song.destroy( 10, 11, 20 )  
SQL = DELETE FROM songs WHERE id IN (10,11,20)

I need

Song.destroy everthing but 10,11,12

SQL = DELETE FROM songs WHERE id NOT IN (10,11,20)

thx CK
