select dwdm,sl from a where dwdm>=30200197 and dwdm<=30200202 union select '66666666' dwdm,sl from a where dwdm<30200197 and dwdm>30200202
sorry,nunchakus(双节棍) 是正解 select dwdm,sl from a where dwdm>=30200197 and dwdm<=30200202 union select '66666666' dwdm,sl from a where dwdm<30200197 or dwdm>30200202
select * from (select dwdm,sl from tbname where dwdm>=30200197 and <=30200202 order by dwdm desc) t union all select dwdm,sl from tbname where dwdm<30200197 or >30200202 ;
union 不行! union 会自动对其进行升序排序。
即把dwdm>=30200197 and <=30200202的按降序排在前面 -------------------- 楼主给出的例子怎么是 升序呢?
union
select '66666666' dwdm,sl from a where dwdm<30200197 and dwdm>30200202
select dwdm,sl from a where dwdm>=30200197 and dwdm<=30200202
union
select '66666666' dwdm,sl from a where dwdm<30200197 or dwdm>30200202
(select dwdm,sl from tbname where dwdm>=30200197 and <=30200202
order by dwdm desc) t
union all
select dwdm,sl from tbname where dwdm<30200197 or >30200202 ;
union 会自动对其进行升序排序。
--------------------
楼主给出的例子怎么是 升序呢?