select mysql data using MAX
Posted
by JPro
on Stack Overflow
See other posts from Stack Overflow
or by JPro
Published on 2010-03-20T14:23:47Z
Indexed on
2010/03/20
14:31 UTC
Read the original article
Hit count: 204
I have a testdata like this:
DROP TABLE SELECT_PASS;
CREATE TABLE SELECT_PASS(ID INT(20),TESTCASE VARCHAR(20),RESULT VARCHAR(20));
INSERT INTO SELECT_PASS VALUES(1,"TC1","PASS");
INSERT INTO SELECT_PASS VALUES(2,"TC2","PASS");
INSERT INTO SELECT_PASS VALUES(3,"TC3","INCONC");
INSERT INTO SELECT_PASS VALUES(4,"TC1","FAIL");
INSERT INTO SELECT_PASS VALUES(5,"TC21","FAIL");
INSERT INTO SELECT_PASS VALUES(6,"TC4","PASS");
INSERT INTO SELECT_PASS VALUES(7,"TC3","PASS");
INSERT INTO SELECT_PASS VALUES(8,"TC2","PASS");
INSERT INTO SELECT_PASS VALUES(9,"TC1","TIMEOUT");
SELECT TESTCASE, MAX(RESULT) FROM SELECT_PASS GROUP BY TESTCASE;
The resultset I get is :
TC1 TIMEOUT
TC2 PASS
TC21 FAIL
TC3 PASS
TC4 PASS
Basically I want to see those testcases which never passed.
Any way to do it?
Thanks.
© Stack Overflow or respective owner