Fixed SQL query
Updated version #