Created
January 15, 2013 15:22
-
-
Save kongelaks/4539387 to your computer and use it in GitHub Desktop.
get distribution of array values in a postgres array field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select count(*), unnest("FIELD_NAME") as field from "TABLE" group by field; |
dbkaigoaig2h9j=> select count(*), unnest("RENTBASE") as field from aarrets2."Property" group by field;
count | field
-------+--------------------
62 | Full
9 | Partial
16 | Partially Finished
16 | Walkout
24 | Finished
7 | Egress
11 | Crawl
18 | Slab
6 | Daylight
7 | Michigan
(10 rows)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
gist should be like this...
dbkaigoaig2h9j=> select count(*), unnest("RESIBASE") as field from aarrets2."Property" group by field;
count | field
-------+--------------------
104 | Crawl
185 | Partially Finished
244 | Walkout
126 | Daylight
247 | Finished
147 | Egress
77 | Slab
822 | Full
104 | Partial
55 | Michigan
(10 rows)