inner join connect separate function