On Sun, Oct 28, 2001 at 01:30:47PM +0100, Peter Eisentraut wrote:
> Peter Pilsl writes:
>
> > Is there a function that returns the number of the current outputline
>
> The client application is going to have to count the row numbers anyway in
> order to loop through them, so there is no obvious benefit of having the
> server deal with this.
in my case I dont think so: for a special task I need to join and sort
the content of several tables with some ranking-values to get the 6
highestranked values of all tables.
The rankingvalue is a function itself and if an entry from table X is
choosen, then - to give entries in other tables more chance - all
other entries from this table should be downranked by 10. If a second
value is choosen, then by 20 and so on ...
Of course I could do this all in the client-application, but there
would be a very easy (and maybe performant) way to do all this in
postgreSQL, if I could only create a function, that would deliver
0,10,20 .. depending on the row it appears.
select value,func from table order by rank(val1,val2,val3);
----+--
val1|0
val2|10
val3|20
I was thinking about doing it with sequences and reset the sequence
before each select-statement, but this will get very complex and lead
to other troubles ...
thnx,
peter
--
mag. peter pilsl
phone: +43 676 3574035
fax : +43 676 3546512
email: pilsl@goldfisch.at
sms : pilsl@max.mail.at
pgp-key available