超难的sql语句,关于union all
有两个表,一个是接受短信表一个是发送的表,想由这两个表得出聊天记录,以一个手机号为例
select detail,mobile,timee from(
select detail,mobile ,sendtime as timee from sendsms where mobile like (cast 13815002455 as nvarchar
union all
select detail,mobile ,recetime as timee from recesms where mobile like
(cast 13815002455 as nvarchar))a order by timee
最后加了order by timee就出错了,不能有order by嘛?但这个必须要以时间来排序的,怎么弄呢?甚至开始怀疑人生。。。