updated joined view sql