# WHERE NOT syntax with ActiveRecord

**URL:** <https://www.ruby-forum.com/t/where-not-syntax-with-activerecord/103132>\
**Category:** Rails\
**Created:** [May 2, 2007, 6:05am UTC](https://www.ruby-forum.com/t/where-not-syntax-with-activerecord/103132 "2007-05-02T06:05:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![willclarkdesigns](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/85f322/32.png) [@willclarkdesigns](https://www.ruby-forum.com/u/willclarkdesigns)\
**Post date:** [May 2, 2007, 6:05am UTC](https://www.ruby-forum.com/t/where-not-syntax-with-activerecord/103132/1 "2007-05-02T06:05:52Z")

</div>

I need to run a sql statement along the lines of SELECT \* FROM items  
WHERE NOT … But I would like to run this in the ActiveRecord syntax. I  
like using :conditions =\> […] but obviously where it renders ‘WHERE  
NOT’ and not simply ‘WHERE’. I’d rather not use find\_by\_sql if at all  
possible for security reasons. Anyone know how to do this?

Thanks,  
Will

---

<div class="post-metadata">

**Author:** ![willclarkdesigns](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/85f322/32.png) [@willclarkdesigns](https://www.ruby-forum.com/u/willclarkdesigns)\
**Post date:** [May 8, 2007, 12:12am UTC](https://www.ruby-forum.com/t/where-not-syntax-with-activerecord/103132/2 "2007-05-08T00:12:20Z")

</div>

Thanks Eden.

---

<div class="post-metadata">

**Author:** ![willclarkdesigns](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/85f322/32.png) [@willclarkdesigns](https://www.ruby-forum.com/u/willclarkdesigns)\
**Post date:** [May 2, 2007, 6:23am UTC](https://www.ruby-forum.com/t/where-not-syntax-with-activerecord/103132/3 "2007-05-02T06:23:31Z")

</div>

Model.find(:all, :conditions =\> [‘NOT column = ?’, var])

On May 2, 12:05 pm, Will C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
