[英]SQL select statement to distinct entries
我的dbase表包含以下字段:
gameid,subscriberid,commatchsno,mobileno,时间戳,哈希码,得分,langType,actualscore,timetaken,vcnumber,subid;
我需要选择分数最高且花费时间更少的唯一(辅助)40个条目。
根据您的SQL风格:
select * from <tablename> order by score, timetaken desc limit 40;
要么:
select top 40 * from <tablename> order by score, timetaken desc;
SELECT distinct actualscore,subid,timetaken,timestamp FROM mytable where score !='invalid score' and actualscore !='0' order by actualscore desc,timetaken asc ,timestamp asc;
上面的查询为我提供了包含多个subids的结果集。 我想通过满足查询中上述给定条件来消除重复项
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.