fix error in query generation
Merge pull request #1488 from craigh/syntaxfix

fix error in query generation