On Thu, 25 Sep 2003 17:45:35 +0200, "Sjors" <jkwast@freeler.nl> wrote:
>now I want to have this:
>
>id name data rank
>1 sully 567 2
>2 sully 789 1
>3 sully 456 3
>4 denan 890 1
>5 denan 678 2
SELECT id, name, data, (SELECT count(*) + 1
FROM tbl AS tmp
WHERE tmp.name = tbl.name
AND tmp.data > tbl.data) AS rank
FROM tbl;
should get you going but might perform horribly without an index on
name ...
Servus
Manfred