I want to count the occurrences of a column of table A to table B.
This query generates the first table
Table A
select geo_address_id
from favourite_address
where rider profile_id = 1;
geo_address_id
--------------
2
8
4
The second table looks like this
Table B
rider_profile_id | geo_addresses| counter
-----------------------------------------
1 8 3
1 2 3
1 6 2
1 4 2
1 1 1
1 5 1
geo_address and geo_address_id are referring to the same thing.
I want to count the occurrences of the geo_addresses_id in the second table and end up with something like that
Table C
geo_addresses | counter
-----------------------
8
2
4
ordered desc
I tried to joined the tables in the geo_addresses but I got some ambiguous errors.