Your query seems to be correct, but stay tuned to the base name. In Wordpress (which I assume you are using), the table name is wp_postmeta
and not wp_postpostmeta
.
In a more comprehensive case, a simple select meta_key, meta_value from wp_postmeta
returns all occurrences of the two fields
EDIT
Your appointment isn’t quite right, at least for me. Are you searching all cities and all neighborhoods, or all neighborhoods of a city? In Wordpress logic, meta_key
determines the field name, while meta_value
, your value. Therefore, you would have meta_key = 'Cidade'
and meta_value = 'Curitiba'
, for example. IN THIS CASE (i.e., if this is your logic), to select all the cities in your relationship, your query would be:
SELECT meta_key, meta_value FROM wp_postmeta WHERE meta_key='Cidade'
So you’d get returns like
meta_key | meta_value
Cidade | Curitiba
Cidade | São Paulo
If, on the other hand, your meta_key
be the NAME of the city, and the meta_value
the NAME of the neighborhood, the consultation
SELECT meta_key, meta_value FROM wp_postmeta WHERE meta_key='São Paulo'
Could return:
meta_key | meta_value
São Paulo | Morumbi
São Paulo | Jabaquara
If this last logic which I have represented is the one which you are following (i.e., meta_key = 'nome_da_cidade'
), and you want to list all the neighborhoods of all cities (again, I’m assuming things here), do:
SELECT meta_key, meta_value FROM wp_postmeta ORDER BY meta_key
I drew my conclusions based on your question. See if I am correct and let me know
Posts more information about the problem, it is not clear what you want and what you do not know.
– Luis Henrique