Bugfix: sql queries for 24 hrs and running/waiting jobs