INSERT IGNORE INTO meta.toShow SELECT PNR , 0 FROM PNR_Trigger.PNR_Ticket_Details where customer='viacom' group by pnr order by date(TimeStamp) desc,PNR asc,Dep_Date asc,Dep_Time asc;