CREATE OR REPLACE TEMPORARY TABLE tmp.tItemShelving (PRIMARY KEY (id)) ENGINE = MEMORY SELECT ish.id, s.id shelvingFk FROM vn.itemShelving ish JOIN vn.shelving s ON s.code = ish.shelvingFk COLLATE utf8mb3_unicode_ci;