Fix a couple queries for postgresql

Select and ordering was wrong on the "Titles" page, and
the dupe-resolve page was throwing an error.