读书人

怎么排序?

发布时间: 2012-01-29 21:39:32 作者: rapoo

如何排序???
1.select * from dzkp a,xcd b where a.chengjiren_id=b.chengjiren_id
2.select kp_code from dzkp where kp_id not in (select a.kp_id from dzkp a,xcd b where a.chengjiren_id=b.chengjiren_id)
3.select xcd_code from xcd where xcd_id not in (select b.xcd_id from dzkp a,xcd b where a.chengjiren_id=b.chengjiren_id)
如何能让这三个显示在一个页面,取得的记录按1.2.3来排列出来.

[解决办法]
try

select a.kp_code from dzkp a,xcd b where a.chengjiren_id=b.chengjiren_id
Union All
select kp_code from dzkp where kp_id not in (select a.kp_id from dzkp a,xcd b where a.chengjiren_id=b.chengjiren_id)
Union All
select xcd_code from xcd where xcd_id not in (select b.xcd_id from dzkp a,xcd b where a.chengjiren_id=b.chengjiren_id)

读书人网 >SQL Server

热点推荐