Altered the sql to include the inspecao table.