sql now working without errors