Your query appears to be correct, but be aware of 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 query is not so correct, at least for me. Are you looking for all the cities And all the neighborhoods, or all the neighborhoods of a city? In WordPress logic, meta_key
determines the name of the field, while meta_value
, its value. Therefore, you would have meta_key = 'Cidade'
and meta_value = 'Curitiba'
, for example. IN THIS CASE (i.e., if your logic is this), 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 would receive returns of type
meta_key | meta_value
Cidade | Curitiba
Cidade | São Paulo
If, on the other hand, your meta_key
is the NAME of the city, and the meta_value
NAME
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 I represented is what you're following (i.e., meta_key = 'nome_da_cidade'
), and you want to list all neighborhoods in 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'm correct and let me know