#286 Fix incorrect SQL Query