当前位置: 代码迷 >> Sql Server >> ,select 查询语句的简化?
  详细解决方案

,select 查询语句的简化?

热度:108   发布时间:2016-04-27 17:23:58.0
求助,select 查询语句的简化??
有一条太长的Select 语句需要简化,大家看看
如下:

select kh COLLATE chinese_PRC_CI_AI as kh,
  rq COLLATE chinese_PRC_CI_AI as rq,
  hs1 COLLATE chinese_PRC_CI_AI as hs1,
  ms1 COLLATE chinese_PRC_CI_AI as ms1
 from kimkqdata where rq='20071010'
union
select kh COLLATE chinese_PRC_CI_AI as kh,
  rq COLLATE chinese_PRC_CI_AI as rq,
  hs1 COLLATE chinese_PRC_CI_AI as hs1,
  ms1 COLLATE chinese_PRC_CI_AI as ms1
 from kqdata where rq='20071010'

------解决方案--------------------
这样已经很好了.

不过COLLATE chinese_PRC_CI_AI可以删除.
------解决方案--------------------
select kh as kh, 
rq as rq, 
hs1 as hs1, 
ms1 as ms1 
 from kimkqdata where rq= '20071010 ' 
union 
select kh as kh, 
rq as rq, 
hs1 as hs1, 
ms1 as ms1 
 from kqdata where rq= '20071010 '
  相关解决方案