INSERT into tasks_master_tracker_idb ( `DIRECTION`, `PROD_INBOUND_TRANSPORT_ADDR`, `PROD_OUTBOUND_TRANSPORT_ADDR`)SELECT t.DIRECTION,rt.TRANSPORT_4FROM tasks t LEFT JOIN requirements_transport rt ON t.ID = rt.INTID__ and rt.ID = (select MAX(ID) from requirements_transport where INTID__ = t.ID)WHERE (t.INTID is not null and t.CUSTID is not null ) AND t.ID not in (select TASK_ID from tasks_master_tracker_idb)
If "t.DIRECTION" is "INBOUND" than I need to insert the "rt.TRANSPORT_4" value into, "PROD_INBOUND_TRANSPORT_ADDR." If "t.DIRECTION" is "OUTBOUND," than I need to insert the "rt.TRANSPORT_4" value into "PROD_OUTBOUND_TRANSPORT_ADDR."
And than if "t.DIRECTION" is "MULTIDIRECTIONAL," than I need to insert the "t.DIRECTION" value into both "PROD_INBOUND_TRANSPORT_ADDR" and "PROD_OUTBOUND_TRANSPORT_ADDR."
I'd like to think that there's a way I can deploy a series of CASES to get that done, but I'm not sure how to pull it off.