首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

怎么排序?

2012-01-29 
如何排序???1.select*fromdzkpa,xcdbwherea.chengjiren_idb.chengjiren_id2.selectkp_codefromdzkpwherek

如何排序???
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)

热点排行