Switched query to use parameter substitution