select * from(
select * from supply
union all
select * from demand
)a order by CreateDate
select * from supply
union all
select * from demand
)a order by CreateDate
解决方案 »
- 建了索引之后count查询速度怎么还是>1秒?
- 怎样把SQL插入的数据变成密码形式的那种
- 怎样去除某个字段重复记录?
- 求教sql2005学习指南
- 怎样把SQL论坛的数据库转移到本机调试论坛中?
- 为什么在xp professional 下安装 sql server 提示 16位dos 不能在32位下运行,我也记不清了
- 使用 sql server 2000 存储过程 sp_xml_preparedocument 解析XML文件,当XML超过varchar(8000) 怎么办???
- 安装好SQL2005为什么不能开IE和遨游
- 提一个很简单的存储过程问题,急用
- sqlserver怎么用程序建库建表,导入导出
- inner join和outer join的效率探讨
- 插入问题.
create table supply(Id int,Title varchar(10),Content varchar(10),CreateDate datetime,Sort varchar(10))
insert into supply
select 1,'t01','c01','2003-1-3','supply'
union all select 2,'t02','c02','2003-1-8','supply'create table demand(Id int,Title varchar(10),Content varchar(10),CreateDate datetime,Sort varchar(10))
insert into demand
select 1,'dt01','dc01','2003-1-4','demand'
union all select 2,'dt02','dc02','2003-1-5','demand'
go--查询
select * from(
select * from supply
union all
select * from demand
)a order by CreateDate
go--删除测试环境
drop table supply,demand/*--测试结果
Id Title Content CreateDate Sort
----------- ---------- ---------- ------------------------- --------
1 t01 c01 2003-01-03 00:00:00.000 supply
1 dt01 dc01 2003-01-04 00:00:00.000 demand
2 dt02 dc02 2003-01-05 00:00:00.000 demand
2 t02 c02 2003-01-08 00:00:00.000 supply(所影响的行数为 4 行)
--*/
select * from supply
union all
select * from demand
)a order by CreateDate