wdjh.net
当前位置:首页 >> sql mAx >>

sql mAx

select 成绩表.* from (select max(成绩) as 成绩,姓名from 成绩表 group by 姓名) temp inner join 成绩表 on temp.姓名=成绩表.姓名and temp.成绩=成绩表.成绩 SELECT * FROM dbo.Data_Education WHERE e_user in (SELECT e_user, max(e_diplo...

max(e)函数求出当前组内记录或所有记录中e的最大值,可以是任意可比较的数据类型,也可以是表达式 此处加max(name),估计是因为没把name放到group by后,对于有group by子句的sql,所有选出列必须为group by列或聚集函数,否则会报错

SELECT T1.IDX,T1,SCORE,T1.CREATE_TIMEFROM TAB_A T1INNER JOIN (SELECT IDX,MAX(SCORE) FROM TAB_A GROUP BY IDX) T2ON T1.IDX = T2.IDX AND T1.SCORE = T2.SCORE

用嵌套查询吧 select user_id from PM_MAN_HOUR_STANDARD where MEMBER_NUMBER =(select MAX(MEMBER_NUMBER) FROM PM_MAN_HOUR_STANDARD )

select distinct(customer),year ,max(amt) from 表名 group by year;

因为你按照日期分组了!~ 如果你想去最大的日期像下面这样写就可以了!~ select max (OrderDate) as OrderDate from dbo.Orders 你要取的是每个月最大值不是吗?所以你的SQL应该是没有问题的!~ 20121112 20121013 20120914 像上面这组值 就是你...

1. select max(aaa),bbb,ccc from x group by bbb,ccc 这个语法是找出bbb, ccc在相同的情况下,aaa的最大值。 2. select max(aaa),max(bbb),ccc from x group by ccc 这个语法是找出ccc相同时的aaa的最大值和bbb的最大值。 举例 aaa bbb ccc 5 4...

转换一下 replicate('0',4 - len(cast(max(字段) + 1 as varchar(4)))) + cast(max(字段) + 1 as varchar(4))

这2个字段,要分别查询的(因为是用聚集函数),不能使用关联 --------------------- SELECT ... ,(SELECT Max(ChangeDate) FROM SalesPriceHistory WHERE ItemCode = S.ItemCode) AS Max ,(SELECT Max(ChangeDate) FROM BuyPriceHistory WHERE ...

select 编号,姓名,级别 from [user] where 编号 in ( select max(编号) from [user] a inner join (select 部门, max(级别) as 级别 from [user] group by 部门) b on a.部门=b.部门 and a.级别=b.级别 group by b.部门, b.级别 )

网站首页 | 网站地图
All rights reserved Powered by www.wdjh.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com