0
当我有两个单独的查询时。mySQL,将字段设置为另一个字段的值
Select `entity_id`,`parent_id`,`name`,`meta_description`
from catalog_category_flat_store_1
where level = 3
and is_active = 1
order by parent_id asc, position asc
,给了我这样的输出:
+-----------+-----------+------------+----------+
| entity_id | parent_id | Name | desc |
+-----------+-----------+------------+----------+
| 1 | 0 | test | text |
+-----------+-----------+------------+----------+
我有这样一个单独的查询,
Select `entity_id`,`parent_id`,`name`,`meta_description`
from catalog_category_flat_store_1
where level = 2
and is_active = 1
order by parent_id asc, position asc
,给了我这样的输出:
+-----------+-----------+------------+----------+
| entity_id | parent_id | Name | desc |
+-----------+-----------+------------+----------+
| 2 | 1 | test2 | text |
+-----------+-----------+------------+----------+
我需要结合他们Ë两个查询,从而使输出看起来像这样:
+-----------+-----------+------------+----------+
| entity_id | parent_nm | Name | desc |
+-----------+-----------+------------+----------+
| 2 | test | test2 | text |
+-----------+-----------+------------+----------+
我试图创建一个子查询做到这一点,但我有没有快乐,任何人都可以提出查询可能如何构建。谢谢