List:General Discussion« Previous MessageNext Message »
From:Victor Subervi Date:September 18 2010 6:46pm
Subject:Too Strange for Words
View as plain text  
Hi;
Can someone please explain to me why Passengers.weight comes up null for the
last value sometimes, and other times it comes up with the value 155??

mysql> select p.id, c.id, p.name, p.weight, m.amount, p.round_trip,
c.first_name, c.middle_name, c.last_name, c.suffix, c.sex, p.confirmation,
m.type, m.payment, p.late_fee, p.late_fee_paid, m.discount from Passengers p
join Customers c join Money m on m.foreign_id=p.id and
m.customer_id=c.idwhere m.type="flight fee" and p.flight_id=1;
+----+----+------+--------+--------+------------+------------+-------------+-----------+--------+------+--------------+------------+---------+----------+---------------+----------+
| id | id | name | weight | amount | round_trip | first_name | middle_name |
last_name | suffix | sex  | confirmation | type       | payment | late_fee |
late_fee_paid | discount |
+----+----+------+--------+--------+------------+------------+-------------+-----------+--------+------+--------------+------------+---------+----------+---------------+----------+
|  1 |  1 | NULL |   NULL |  70.00 |          0 | Adolph     | NULL        |
Hitler    | NULL   | Male | 123456       | flight fee | CC      | no       |
n/a           |        0 |
|  2 |  1 | NULL |   NULL |  70.00 |          0 | Adolph     | NULL        |
Hitler    | NULL   | Male | 987987987    | flight fee | cash    | no       |
n/a           |        0 |
|  3 |  3 | NULL |   NULL |  70.00 |          0 | Me         | NULL        |
Too       | NULL   | Male | 123456       | flight fee | CC      | no       |
n/a           |       20 |
+----+----+------+--------+--------+------------+------------+-------------+-----------+--------+------+--------------+------------+---------+----------+---------------+----------+
3 rows in set (0.00 sec)

mysql> select * from Passengers;
+----+-----------+-------------+------+------+--------+-------+------------+--------------+----------+---------------+
| id | flight_id | customer_id | name | sex  | weight | price | round_trip |
confirmation | late_fee | late_fee_paid |
+----+-----------+-------------+------+------+--------+-------+------------+--------------+----------+---------------+
|  1 |         1 |           1 | NULL | Male |   NULL |  0.00 |          0 |
123456       | no       | n/a           |
|  2 |         1 |           1 | NULL | Male |   NULL |  0.00 |          0 |
987987987    | no       | n/a           |
|  3 |         1 |           2 | NULL | Male |   NULL |  0.00 |          0 |
123456       | no       | n/a           |
|  4 |         1 |           3 | NULL | Male |    155 | 70.00 |          0 |
123456       | no       | n/a           |
+----+-----------+-------------+------+------+--------+-------+------------+--------------+----------+---------------+
4 rows in set (0.00 sec)

mysql> select p.weight from Passengers p;
+--------+
| weight |
+--------+
|   NULL |
|   NULL |
|   NULL |
|    155 |
+--------+
4 rows in set (0.00 sec)

TIA,
Victor

Thread
Too Strange for WordsVictor Subervi18 Sep
  • Re: Too Strange for WordsDan Nelson19 Sep