edit view and add sql