SQL заменить идентификатор с имени из другой таблицы

The answer of sagi did not really work correctly.

I've found a much simpler and working solution in another thread:

SQL Replace multiple variables from another table in query result
Santino