MYSQL Trigger 'stop duplicates' -


i've looked @ couple of other posts being newbee cannot work! using following fill table 'bookings_report' data using trigger below. each time runs enters records bookings table using joins give data need. works ok after each insert on bookings table, every record inserted bookings_report not latest insert. understand why , think need either use 'insert ignore' or 'where' condition somehow put latest record 'bookings_report' table can't work out best approach. appreciated!

create trigger bookings_report_insert  after insert on bookings each row begin insert bookings_report (report_id, booking_id, date_ammended, action, firstname, lastname, booking_date, period, resource, booking_notes) select null, bookings.booking_id, now(), "insert", users.firstname, users.lastname, bookings.date, periods.name, rooms.name, bookings.notes  from((( bookings  join users on bookings.user_id = users.user_id)  join periods on periods.period_id = bookings.period_id)  join rooms on rooms.room_id = bookings.room_id); end 


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -