This answer that was already given to you by @robert_volk should help guide you. Also read the documentation of temp tables