I’m trying to put a where clause in a select distinct query in postgresql but having no luck.
I want to do the following:
select distinct on (state_or_county) state_or_county
from locations
where country = "USA"
I’ve done this many times in mysql and can’t understand why this isn’t working.
Can someone please correct the query? Or explain just why it isn’t working?
In postgresql a string literal must be wrapped in single quotes:
Double quotes are used for identifiers, if needed: