fix sql statement for performance
Merge pull request #1603 from marcel-blonk/PLFM-3099

fix sql statement for performance