complete from join clause and add where clause to complete