Makes inner joins work properly