My question is simple, atleast, I tought.
Given the following situation
> CREATE TABLE `robots` (
> `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
> `name` varchar(70) NOT NULL,
> `type` varchar(32) NOT NULL,
> `year` int(11) NOT NULL,
> PRIMARY KEY (`id`)
> );
>
> CREATE TABLE `robots_parts` (
> `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
> `robots_id` int(10) NOT NULL,
> `parts_id` int(10) NOT NULL,
> `created_at` DATE NOT NULL,
> PRIMARY KEY (`id`),
> KEY `robots_id` (`robots_id`),
> KEY `parts_id` (`parts_id`)
> );
>
> CREATE TABLE `parts` (
> `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
> `name` varchar(70) NOT NULL,
> PRIMARY KEY (`id`)
> );
I would like to query Robots for all the robots that have a Part called "lasers" for example. The documentation doesn't state anything on this subject.
Seems to be a simple where clause, but is it possible to achieve this without making a custom query?