select concat('update ROOM_OCCUPATION set ROOM_OCCUPATION.KEY_LESSON = ', 
	LESSON.ID_INTERNAL, 
	' where ROOM_OCCUPATION.ID_INTERNAL = ', 
	ROOM_OCCUPATION.ID_INTERNAL, ';') as "" 
from LESSON inner join ROOM_OCCUPATION on ROOM_OCCUPATION.ID_INTERNAL = LESSON.KEY_ROOM_OCCUPATION;
