From: | Peter Pilsl <pilsl(at)goldfisch(dot)at> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | variables in functions .. |
Date: | 2001-10-24 20:36:34 |
Message-ID: | 20011024223634.J34156@i3.atat.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I need a query like
select column,x from table where .... order by ...;
where x should return 0 for the first shown entry, 10 for the second,
20 for the third and so on. Is there a way to create a function doing
this (it needs a memory or needs to have access to some internal
variables).
However, this is not the realworld-example. The original task is:
select 6 values out of 10 tables trought sorting each table internal
according to a 'ranking'-functions and then choose the highest 6, but
as soon as entry from one table is choosen, the others should be
ranked down by 10, so two entries from the same table will only be
choosen if all other entried are ranked very bad ...
I wonder if there is a fast SQL-operation to do so or if I'm faster
off by doing it in C or perl outside. This problem reduces to the
above question...
thnx,
peter
--
mag. peter pilsl
phone: +43 676 3574035
fax : +43 676 3546512
email: pilsl(at)goldfisch(dot)at
sms : pilsl(at)max(dot)mail(dot)at
pgp-key available
From | Date | Subject | |
---|---|---|---|
Next Message | Martín Marqués | 2001-10-24 20:47:13 | postgres user authentification |
Previous Message | Alexey V. Borzov | 2001-10-24 19:44:48 | Re: PHP code to unescape data retrieved from a bytea column |