select UserID,aTime as time,aValue as value,aType as type from TabA
where userid=1
union all
select userid,btime,bvalue,null from tabb where userid=1
where userid=1
union all
select userid,btime,bvalue,null from tabb where userid=1
解决方案 »
- mssql 标量函数
- wingate的"SOCKS Proxy server"中用户认证为什么一直用不了?100分求经验
- 删除表问题?
- 请问大虾:如何让把单选按钮的值写进数据库?
- 排列顺序不固定 sql怎么写?
- 邹健等大侠请忙,请问有内外联的sql结果集的过滤问题!
- 怎么用like找出以0开头的由任意个0组成的字符串?
- 关于Sqlserver 2005 全文检索的困惑
- sql2005 简单恢复模式下 使用backup log with NO_log是否没有意义?
- 请问为什么sql server2000数据库里的数据在Win XP下不能显示中文啊??
- 问题:如何改变数据库大小的问题
- 一个小小的问题。
select UserID,aTime as [time],aValue as value,aType as type from TabA
where userid=1
union all
select userid,btime,bvalue,null from tabb where userid=1
order by [time] desc
from
(
select userid,[time]=atime,[value]=avalue,[type] from table1
union all
select *,null from table2
) a
where userid='1'
order by [time] desc