Query::queryScalar wasn't making SELECT DISTINCT queries subqueries
Fix for logic Query::queryScalar uses to check for SELECT DISTINCT
Merge pull request #2581 from jom/query-scalar-fix

SELECT DISTINCT queries made subqueries in Query::queryScalar