Updated Sql script and fine query