请帮我解决这个问题。当第 2 列以第 1 列相同的方式获得结果时,我得到空值。
select
(case when parents = '3' then child end) 3_rec,
(case when parents = '10' then child end) 10_rec
from
(
SELECT concat(a.name,' (',b.count,')') as child,b.parent as parents FROM wp_terms a,wp_term_taxonomy b where
a.term_id=b.term_id and b.parent = 3 and b.taxonomy = 'category'
union all
SELECT concat(a.name,' (',b.count,')') as child,b.parent as parents FROM wp_terms a,wp_term_taxonomy b where
a.term_id=b.term_id and b.parent = 10 and b.taxonomy = 'category'
) d order by 1,2 asc
我期待的结果。Null 应该排在最后。
3_rec|10_rec
------------
row1 | row1
row2 | row2
row3 | row3
| row4
| row5