0

Have a code in MSSQL

SELECT     TOP 100 PERCENT Acct, Currency, COUNT(Name) AS NB
FROM        Details
GROUP BY Acct, Currency

Please help me by providing the equivalent code in PostgreSQL.

dn2301
  • 5
  • 4
  • That seems totally useless. `top 100 percent` is the same as "all rows" –  Feb 04 '21 at 07:11
  • Does this answer your question? [Postgresql : How do I select top n percent(%) entries from each group/category](https://stackoverflow.com/questions/24626036/postgresql-how-do-i-select-top-n-percent-entries-from-each-group-category) – astentx Feb 04 '21 at 08:39

1 Answers1

0

In any database, you would just use:

SELECT Acct, Currency, COUNT(Name) AS NB
FROM Details
GROUP BY Acct, Currency;

The TOP 100 PERCENT is a no-op. It just returns all the data that would be returned anyway.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786