SELECT t1.name,t2.name FROM table1 t1 FULL JOIN table t2 ON t1.name=t2.name
查询2个字段都相同的表,仅仅时间不同,我要查询name字段,但是表1中有,表2中不一定有,表2中有,表1中也不一定有,请问我如何进行排序?
假如查询结果是:
n10 n10
n3 n3
null n4
n1 null
n2 n2
我想变成
n1 null
n2 n2
n3 n3
null n4
n10 n10
------解决方案--------------------------------------------------------
SELECT t1.name,t2.name FROM table1 t1 FULL JOIN table t2 ON t1.name=t2.name
order by NVL(t1.name,t2.name)
------解决方案--------------------------------------------------------