Jeffrey Ratcliffe
<[EMAIL PROTECTED]> wrote:
Even better. Thanks again. But in the case where there ARE duplicates:
CREATE TEMPORARY TABLE temp (eid, P, subcase);
INSERT INTO temp (eid, P, subcase) VALUES (1, 1, 'a');
INSERT INTO temp (eid, P, subcase) VALUES (1, 1, 'b');
INSERT INTO temp (eid, P, subcase) VALUES (2, 2, 'a');
INSERT INTO temp (eid, P, subcase) VALUES (2, 2, 'b');
SELECT eid, P, subcase
FROM temp a1
WHERE NOT EXISTS (
SELECT *
FROM temp a2
WHERE a2.eid == a1.eid AND a2.P < a1.P
)
ORDER BY eid;
DROP TABLE temp;
I get:
1,1,a
1,1,b
2,2,a
2,2,b
I would like:
1,1,a (or 1,1,b it doesn't matter which)
2,2,a (or 2,2,b)
Add "group by eid"
Igor Tandetnik
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------