0

This query works in Oracle:

select count(city) - count (distinct city) from station;

But doesn't work in MySQL. What's the MySQL equivalent of this query? At the risk of pointing out obvious, this query returns the 'difference' between 'total no. of cities' on the station table and number of distinct cities.

0

1 Answer 1

6

It should work just fine if you remove space after second count

select count(city) - count(distinct city) from station;
                          ^

Here is a SQLFiddle

To use the name as a function call in an expression, there must be no whitespace between the name and the following “(” parenthesis character.

See 10.2.4 Function Name Parsing and Resolution

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.