Fixed sql query
Merge pull request #140 from Lerogero/master

Fixed sql query