fix sql statement for performance
Merge pull request #1604 from marcel-blonk/release-67

fix sql statement for performance