updated sql for worker