电话
400 9058 355
-->Title:生成測試數據
-->Author:wufeng4552
-->Date :2009-09-21 15:08:41
declare @T table([Col1] int,[Col2] int,[Col3] int,[Col4] int,[Col5] int,[Col6] int,[Col7] int)
Insert @T
select 1,10,20,30,40,50,60 union all
select 2,60,30,45,20,52,85 union all
select 3,87,56,65,41,14,21
--方法1
select [col1],
max([col2])maxcol
from
(select [col1],[col2] from @t
union all
select [col1],[col3] from @t
union all
select [col1],[col4] from @t
union all
select [col1],[col5] from @t
union all
select [col1],[col6] from @t
union all
select [col1],[col7] from @t
)T
where [col2] between 20 and 60 --條件限制
group by [col1]
/*
col1 maxcol
----------- -----------
1 60
2 60
3 56
(3 個資料列受到影響)
*/
--方法2
select [col1],
(select max([col2])from
(
select [col2]
union all select [col3]
union all select [col4]
union all select [col5]
union all select [col6]
union all select [col7]
)T
where [col2] between 20 and 60) as maxcol --指定查詢範圍
from @t
/*
(3 個資料列受到影響)
col1 maxcol
----------- -----------
1 60
2 60
3 56
*/
邮箱:8955556@qq.com
Q Q:8955556
这篇文章主要为大家详细介绍了Android自定义控件实现底部...
这篇文章主要介绍了Android中Toolbar随着Scro...
本文主要介绍了Java图表类库的相关知识。具有很好的参考价值...
本文主要介绍了GIt的基本操作。具有很好的参考价值,下面跟着...
共享内存是在两个正在运行的进程之间共享和传递数据的一种非常有...
这篇文章主要为大家详细介绍了Android自定义相机实现定时...
这篇文章主要介绍了CentOS6.5 上部署 MySQL5....
这篇文章主要介绍了Vue结合原生js实现自定义组件自动生成示...
最近在学习python网络编程这一块,在写简单的socket...
这篇文章主要介绍了微信小程序 数据交互与渲染实例详解的相关资...