好像没有这样的函数,可以这样
select max(aa.kk) 最大值
from (select k1 as kk from 表 where 条件 union all
select k2 as kk from 表 where 条件 union all
select k3 as kk from 表 where 条件 union all
select k4 as kk from 表 where 条件 union all
select k5 as kk from 表 where 条件 ) aa
select max(aa.kk) 最大值
from (select k1 as kk from 表 where 条件 union all
select k2 as kk from 表 where 条件 union all
select k3 as kk from 表 where 条件 union all
select k4 as kk from 表 where 条件 union all
select k5 as kk from 表 where 条件 ) aa
解决方案 »
- 请教日期格式化的问题
- 奇怪了 SQL SERVER2005 安装时 设置身份验证 点下一步没有反映 只能以windows验证安装?
- 求高人点滴
- 要求用一个sql语句求出每个新闻分类的前N条记录
- Access数据库是不是会丢失数据呀
- osql调用外部*.sql文件再远程数据库上创建表失败
- 联合查询分页!请问这个存储过程哪里出错了?应该怎么写呢?
- 转换问题
- NOT IN的奇怪问题,高手来看看!
- 哪里有专门介绍InstallShield的书籍下载???请高人指路!!不胜感激!
- 从服务器导出数据库的时候,只把表导过来了,可是存储过程没有导过了,如何才能把存储过程也拷贝到本机??
- █㊣小政哥㊣█考验一下大家的同情心,1分一个问题(关于将两个记录集连接到一起)?
when k2>=k3 and k2>=k4 and k2>=k5 then k2
when k3>=k4 and k3>=k5 then k3
when k4>=k5 then k4
else k5
end
union all
select max(k2) as kk from table
union all
select max(k3) as kk from table
union all
select max(k4) as kk from table
union all
select max(k5) as kk from table) newtable order by kk desc