Fixed a typo in an ordering query

I had fixed this in another branch but forgot to add the fix in master. This fixes the breakage in http://ci.openquake.org/job/master_oq-engine/537/testReport/junit/tests.db.models_test/GmfsPerSesTestCase/test_branch_lt/