提交 192c1525 authored 作者: Thomas Mueller's avatar Thomas Mueller

Fix test

上级 9319d138
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
-- --
--- special grammar and test cases --------------------------------------------------------------------------------------------- --- special grammar and test cases ---------------------------------------------------------------------------------------------
-- TODO
create table results(eventId int, points int, studentId int); create table results(eventId int, points int, studentId int);
> ok > ok
...@@ -19,25 +17,38 @@ insert into results values(1, 10, 3), (2, 20, 3), (3, 5, 3); ...@@ -19,25 +17,38 @@ insert into results values(1, 10, 3), (2, 20, 3), (3, 5, 3);
> update count: 3 > update count: 3
SELECT SUM(points) FROM RESULTS SELECT SUM(points) FROM RESULTS
WHERE eventID IN WHERE eventID IN
(SELECT eventID FROM RESULTS (SELECT eventID FROM RESULTS
WHERE studentID = 2 WHERE studentID = 2
ORDER BY points DESC ORDER BY points DESC
LIMIT 2 ) LIMIT 2 )
AND studentID = 2; AND studentID = 2;
> SUM(POINTS)
> -----------
> null
> rows (ordered): 1
SELECT eventID FROM RESULTS SELECT eventID FROM RESULTS
WHERE studentID = 2 WHERE studentID = 2
ORDER BY points DESC ORDER BY points DESC
LIMIT 2; LIMIT 2;
> EVENTID
> -------
> 2
> 1
> rows (ordered): 2
SELECT SUM(r.points) FROM RESULTS r, SELECT SUM(r.points) FROM RESULTS r,
(SELECT eventID FROM RESULTS (SELECT eventID FROM RESULTS
WHERE studentID = 2 WHERE studentID = 2
ORDER BY points DESC ORDER BY points DESC
LIMIT 2 ) r2 LIMIT 2 ) r2
WHERE r2.eventID = r.eventId WHERE r2.eventID = r.eventId
AND studentID = 2; AND studentID = 2;
> SUM(R.POINTS)
> -------------
> 30
> rows (ordered): 1
drop table results; drop table results;
> ok > ok
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论