Thanks to visit codestin.com Credit goes to postgrespro.com
"Andreas" <[email protected]> writes: > Example: > > Fruit Count % > -------------------------- > Bananas 5 10% > Apples 15 30% > Oranges 30 60% select fruit_name, count(*), round(count(*)::numeric / (select count(*) from basket) * 100, 0)::text||'%' as "%" frombasket group by fruit_nameorder by "%"; fruit_name | count | % ------------+-------+-----Bananas | 5 | 10%Apples | 15 | 30%Oranges | 30 | 60% (3 rows) -- Gregory Stark EnterpriseDB http://www.enterprisedb.com
pgsql-sql by date:
Соглашаюсь с условиями обработки персональных данных