I have 2 tables:
table_name:
user_tracking
With columns: id, bill_no, container_type, origin_id, destination_idtable_name:
sea_ports
With columns: id, bill_no, port_name
I want to write a single query to get the origin port_name and the destination port_name.
my query is :
select a.container_type,
b.port_name as origin_port
from user_tracking a
left join sea_ports b
on a.bill_no = b.bill_no
where a.bill_number = '$bill_no'
How do I join the two columns origin_id
and destination_id
on the same field id
from the table sea_ports
to get two different outputs?