Delating innecessary sql