I’ve been toying with row_number() and then sort by row_number descending and pick off the first row as the total number.
pgsql-general by date:
Соглашаюсь с условиями обработки персональных данных