ANTON KADACH

Generation

text to sql syntaxWed, 18 Jan 2023

запрос, который рекурсивно находит все гео-объекты по дереву и выводит наименование всех гео-объектов дерева в одну строку

SELECT ( SELECT geoname FROM mfa_geo_object WHERE id = ( SELECT parent_id FROM mfa_geo_object WHERE id = ( SELECT parent_id FROM mfa_geo_object WHERE id = o.id ) ) ) as first, ( SELECT geoname FROM mfa_geo_object WHERE id = ( SELECT parent_id FROM mfa_geo_object WHERE id = o.id ) ) as second, ( SELECT geoname FROM mfa_geo_object WHERE id = o.id )

Questions about programming?Chat with your personal AI assistant