Revert change on SQL query. To be checked.