Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
Posted: Tue Jun 14, 2005 6:30 pm Post subject:
rublu,
Try this sql. I did not get a chance to test it
Code:
SELECT C.ID
,C.VAL
FROM (SELECT A.ID ID
,A.VALUE VAL
,COUNT(*) SEQ
FROM TABLE A
,TABLE B
WHERE A.ID = B.ID
AND A.VALUE <= B.VALUE
GROUP BY A.ID
,A.VALUE) C
WHERE C.SEQ <= 2
;
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum