Skip to content
Advertisement

Count city and State from 2 different tables

I need to count the number of cities occurrences on 2 different tables. One Table is the Supplier table which has supplier_id, City and State. The second table is consumer with consumer id , City and State. My query needs to return the State, City number of supplier cities and number of consumer cities where the names match.

I have tried a couple different things like intersect and union all but cant get it My latest is below but it is Not sure what I am doing wrong

Advertisement

Answer

Use union all and group by:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement