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 |
+-----------+-----------+------------+----------+
我試圖創建一個子查詢做到這一點,但我有沒有快樂,任何人都可以提出查詢可能如何構建。謝謝