I have a trip table with columns from_city and to_city which contain foreign key to city table.
How to join with a city table with id as primary key so that I get a result joined table with from_city_name and to_city_name?
Do an inner join twice, as illustrated below. For more information on SQL joins see MySQL Join Made Easy For Beginners
SELECT
B.name from_city_name, C.name to_city_name
FROM
trip A
INNER JOIN
city B
ON A.from_city=B.id
INNER
JOIN city C
ON A.to_city=C.id;
citytable twice using different aliases.