use single SQL query when listing jobs