# Finds and Single Table Inheritance

**URL:** <https://www.ruby-forum.com/t/finds-and-single-table-inheritance/115379>\
**Category:** Rails\
**Created:** [September 24, 2007, 5:38pm UTC](https://www.ruby-forum.com/t/finds-and-single-table-inheritance/115379 "2007-09-24T17:38:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![almes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/5daacb/32.png) [@almes](https://www.ruby-forum.com/u/almes)\
**Post date:** [September 24, 2007, 5:38pm UTC](https://www.ruby-forum.com/t/finds-and-single-table-inheritance/115379/1 "2007-09-24T17:38:47Z")

</div>

Can someone please help me understand the results that are being  
produced when doing queries on a table that is using single  
inheritance.

Table1 \< ActiveRecord::Base  
Role1 \< Table1  
Role2 \< Table1  
Role3 \< Table1

1. Role1.find(:all) produces:  
“SELECT \* FROM table1 WHERE type = ‘Role1’”

2. any other find on table1 that calls anything but the Role1 Class

EXAMPLES. Table1.find(:all) or Table1.find(:all, :conditions =\> ['type  
= “Role2”]

1. After doing a find like one of the examples from step 2, then do  
the original find from step one. (Role1.find(:all))  
This now produces the following MySQL:

SELECT \* FROM Table1 WHERE type = ‘Role1’ or type = ‘Role2’ OR type =  
‘Role3’

Can someone please help shed some light on what is going on here.  
Specifically why is the sql different for the same query??? Thanks
