Select location from the status

0

I have the following (fictitious) structure

Status table:

id | name | status 

Location table:

id | title | estado_id

On my front end I have a navbar that will list the states and in each state the locations.

I'm using the following query

SELECT estado.name, localizacao.title
FROM estado
INNER JOIN localizacao ON estado.id = localizaçao.estado_id

It works cool, the problem is that it returns the state according to the amount of location.

Follow example of the return

name  | title 
EUA   | cidade
EUA   | cidade
USA.  | cidade

I do not want the USA to repeat.

I solved temporarily using two separate queries.

    
asked by anonymous 10.03.2018 / 02:07

0 answers