MySQL - How to modify parent/child select query to add more children to existing array/JSON?
- 阅读更多 关于 MySQL - How to modify parent/child select query to add more children to existing array/JSON?
问题 I have the following query working OK: SELECT core_condition AS name, NULL AS parent FROM condition_theme_lookup UNION ALL SELECT theme_name AS name, condition_theme_lookup.core_condition AS parent FROM theme, condition_theme_lookup UNION ALL SELECT strand.strand_name AS name, theme.theme_name AS parent FROM strand JOIN theme ON theme.theme_pk = strand.theme_fk The resulting array, with some PHP, produces the following JSON, which is fine so far, showing the 'strand' children of 'theme'