親をこのクエリから一意にしたい:
select
*,
(select state_name
from tbl_states
where state_id = tbl_cities.parent_id) as parent
from
tbl_cities
ORDER BY
parent
私は使用しようとしました:
select
*,
DISTINCT (select state_name
from tbl_states
where state_id = tbl_cities.parent_id) as parent
from
tbl_cities
ORDER BY
parent
しかし、それはエラーを出します。