Table has two columns which concatenate as ‘ab’. I’d like a count of the unique values from the concatenated columns ‘ab’, here is what I have so far;
initial_db=> SELECT concat(street_num, street_name) AS ab FROM recs limit 5;
ab
------------
21ESSEX RD
21ESSEX RD
5AUSTIN ST
5AUSTIN ST
5AUSTIN ST
(5 rows)
initial_db=>
What I’d like is something like this;
count ab
----- -----
2 21ESSEX RD
3 5AUSTIN ST
Any help would be appreciated!
2
Answers
You can use
group by
.Here a detailed explanation how it works:
https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-group-by/