E
E
EvgMul2017-03-13 08:04:46
PostgreSQL
EvgMul, 2017-03-13 08:04:46

Why doesn't sorting work in PostgreSQL?

Hello. I have the following request:

SELECT 
  city, count(*)
FROM 
  ip
GROUP BY
  city;

But I need to sort the records alphabetically.
I'm trying to do the following:
SELECT 
  city, count(*)
FROM 
  ip
GROUP BY
  city ASC;

A syntax error is thrown. Can you please tell me how to sort the records?
Thanks in advance to all who respond.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Falseclock, 2017-03-13
@EvgMul

ORDER BY city

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question