Hi;
I have this code:
select f.id from Flights f join Planes p where f.plane_id=p.id and
p.in_service=1
mysql> describe Flights;
+-------------+-------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| plane_id | int(11) | NO | MUL | NULL | |
| pilot_id | int(11) | NO | MUL | NULL | |
| flight_date | date | NO | | NULL | |
| departure | time | NO | | NULL | |
| arrival | time | NO | | NULL | |
| origination | enum('STT','STX') | YES | | NULL | |
| destination | enum('STT','STX') | YES | | NULL | |
| price | float(6,2) | NO | | NULL | |
+-------------+-------------------+------+-----+---------+----------------+
mysql> describe Planes;
+--------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(20) | NO | | NULL | |
| in_service | tinyint(1) | NO | | 1 | |
| capacity | tinyint(2) | NO | | NULL | |
| total_weight | int(6) | NO | | NULL | |
+--------------+-------------+------+-----+---------+----------------+
My goal is to exclude results in which in_service !=1; however, the filter
isn't working. Please advise.
TIA,
Victor