You should never have a sql command in your views. Pass this in from the controller.