select * from company_user where uid=(select max(uid) from company_user) limit 1,1
、、、汗 。。mysql 基础看过了没有?top 是access 、SqlServer的。 mysql不支持 top 的。
可以这么写。
select * from usert order by gongz desc limit = 1,1
这样就可以了。
如果考虑例如有两个同分数的第二名可以用下面的语句:SELECT a.name, a.subject, a.score FROM stuscore AS a WHERE
(SELECT COUNT(DISTINCT score) FROM stuscore AS b
WHERE b.subject = a.subject AND b.score >= a.score) <= 2
ORDER BY a.subject ASC, a.score DESC
如果有同分数的两个第二名则删除第二名:
SELECT a.name, a.subject, a.score FROM stuscore AS a WHERE
(SELECT COUNT(*) FROM stuscore AS b
WHERE b.subject = a.subject AND b.score >= a.score) <= 2
ORDER BY a.subject ASC, a.score DESC
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)