日期:2014-05-18  浏览次数:20440 次

求助,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 '