当前位置:数据库 > MySQL >>

mysql数据库中limit的问题

如图所示我如何取得前20%,40%,这是MYSQL数据库,另外附上我的sql代码 SELECT sum(sns_examdetail.SCORE) as student_score, B.exam_name as exam_name, sns_examdetail.STUDENT_ID as student_id FROM sns_exam , (select count(A.student_id) as student_count,A.exam_name as exam_name from sns_examdetail,sns_exam, (SELECT sns_examdetail.EXAM_ID as exam_id, sns_exam.EXAM_NAME as exam_name, sns_examdetail.STUDENT_ID AS student_id FROM sns_exam , sns_examdetail where sns_exam.EXAM_ID = sns_examdetail.EXAM_ID and sns_examdetail.PROBLEM_ID is null and sns_examdetail.STATUS <> 0 and sns_exam.EXAM_NAME = '海淀' and sns_exam.AREA_ID = '13' group by student_id) as A where A.exam_id = sns_exam.EXAM_ID and A.student_id = sns_examdetail.STUDENT_ID group by exam_name) as B, sns_examdetail where sns_exam.EXAM_ID = sns_examdetail.EXAM_ID and B.exam_name = sns_exam.EXAM_NAME and sns_examdetail.STATUS <> 0 and sns_examdetail.PROBLEM_ID is null and sns_exam.EXAM_NAME = '海淀' and sns_exam.AREA_ID = '13' group by student_id order by student_score desc
Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,