title: How do I add NEW.[table alias].[table column] MySQL Trigger
body: <p>I am not sure how to do this with insert trigger.  I want to add a log which inserts from a "somewhat complex" Select statement with a few Joins so I need table alias.  When I run a test insert I get.  Basically all the columns will need to select NEW.[table alias].[column name] but Only addded SELECT NEW.p.passenger_id, NEW.p.first_name for simplicity</p>
  
  <p><code>Error Code: 1054. Unknown column 'NEW.p.passenger_id' in 'field list'</code></p>
  
  <p>Here is code</p>
  
  <pre><code>DROP TRIGGER IF EXISTS trip_after_insert;
  DELIMITER //
  CREATE TRIGGER trip_after_insert
      AFTER INSERT ON passenger_schedule
      FOR EACH ROW
  BEGIN
  INSERT INTO trip_purchase_audit 
      (passenger_id,
      first_name,
      last_name,
      train_id,
      sequence,
      car_number,
      from_station_id,
      start_station_name,
      to_station_id,
      to_station_name,
      ticket_cost,
      travel_date,
      action_type,
      action_date)
  SELECT NEW.p.passenger_id, NEW.p.first_name, p.last_name, ps.train_id, ps.sequence, car_number,
  ts.station_start_id, s1.station_name as station_start, ts.station_end_id, s2.station_name as station_end, 
  ps.ticket_cost, ps.travel_date, 'TICKET PURCHASE', NOW()
  FROM passenger_schedule ps 
      JOIN passengers p ON ps.passenger_id = p.passenger_id
      JOIN train_schedule ts ON ps.train_id = ts.train_id
                            AND ps.sequence = ts.sequence
                            AND ps.ticket_cost = ts.ticket_cost
      RIGHT JOIN stations s1 ON ts.station_start_id = s1.station_id
      RIGHT JOIN stations s2 ON ts.station_end_id = s2.station_id;
  END//
  
  INSERT INTO passenger_schedule 
  VALUES 
  (5007, 4, 2, 4, 8, '2019-01-21'),
  (5008, 2, 1, 1, 9, '2019-01-21');
  </code></pre>