Displaying 1 result from an estimated 1 matches for "pettype".
Did you mean:
gettype
2006 Jan 10
5
Noob ActiveRecord Join Question
...sh - bird -
etc.
Pets table
CREATE TABLE `pets` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(20) default NULL,
`pet_id` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
Types table
CREATE TABLE `types` (
`id` int(11) NOT NULL auto_increment,
`pettype` varchar(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
What I want to do is to associate the pet_id from Pets with the id from
types, and can do that in SQL like this:
select pets.*, types.pettype
from pets, types
where pets.id = 1
and pets.pet_id = types.id
In...