怎么把两条sql语句查询的结果放在一起(子节点父节点分开查询)select xxx as id, yyy as pid from t1selec
怎么把两条sql语句查询的结果放在一起(子节点父节点分开查询)
select xxx as id, yyy as pid from t1;
select zzz as id, 'root' as pid from t2;
第一句话查询子节点 第二句话查询父节点
这样查出来的结果是分开的两组
我想把查询的结果放在一起,该怎么实现?
[解决办法]
select xxx as id, yyy as pid from t1
UNION ALL
select zzz as id, 'root' as pid from t2
是这样吗?
