Diagram:

=============================================
|  team_id  | name    |  opponent           |  
---------------------------------------------
|     10    | Florida | Charleston Southern |
---------------------------------------------
|     10    | Florida | Troy                |
---------------------------------------------
|     10    | Florida | Tennessee           |
---------------------------------------------
|     10    | Florida | Kentucky            |
---------------------------------------------
|     10    | Florida | LSU                 |
---------------------------------------------
|     10    | Florida | Arkansas            |
---------------------------------------------
|     10    | Florida | Mississippi St.     |
---------------------------------------------
|     10    | Florida | Georgia             |
---------------------------------------------
|     10    | Florida | Vanderbilt          |
---------------------------------------------
|     10    | Florida | South Carolina      |
---------------------------------------------
|     10    | Florida | Florida Int'l       |
---------------------------------------------
|     10    | Florida | Florida St.         |
---------------------------------------------
=============================================

As you can hopefully see by this diagram, there are 12 rows being 
returned that contain these values.

In my teams table the team_ids for each of the opponents are:



===================================
|  id       | name                |  
-----------------------------------
|     --    | Charleston Southern |
-----------------------------------
|     12    | Troy                |
-----------------------------------
|     44    | Tennessee           |
-----------------------------------
|     53    | Kentucky            |
-----------------------------------
|     62    | LSU                 |
-----------------------------------
|     11    | Arkansas            |
-----------------------------------
|     19    | Mississippi St.     |
-----------------------------------
|     41    | Georgia             |
-----------------------------------
|     59    | Vanderbilt          |
-----------------------------------
|     86    | South Carolina      |
-----------------------------------
|     97    | Florida Int'l       |
-----------------------------------
|     40    | Florida St.         |
-----------------------------------
===================================

Notice that the first team doesn't exist in my table at all.  So, that 
opponent won't be found (they are in division 2).  The rest of the teams 
are in the team's table and all have foreign keys assigned for team_id. 
However, I can't figure out how to reference another team within the 
same query..

I hope the diagrams help a little.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to