[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] PostgreSQL og rang udregning



Troels Arvin wrote:
On Fri, 09 Jun 2006 23:06:13 +0200, Jesper K. Pedersen wrote:

Det er let at rangere spillere med en simpel select ... order by score limit 40


Pas på med LIMIT. Hvad så hvis der er flere folk med samme score, inden
for top-40?

Overvej et kig på
http://troels.arvin.dk/db/rdbms/#select-top-n-postgresql

>

Resultatet skal ikke være et "top-n" resultat - men et resultat med "max-n" folk da der kun er point til 40 personer (hvilket kan give nogle uheldige effekter når der skal "rafles" om, hvem får de mindste point hvis det skete at personerne på position 40 og 41 har samme score)

>

Jeg kan bare ikke helt gennemskue muligheden for direkte i SQL at bruge
denne "orden" til at hente data fra en point tabel.


Du burde kunne ordne det med et sub-query eller to. Eller to kan skabe et
"orden"-view og join'e på det. I det hele taget kan jeg anbefale at bryde
SQL-udfordringer ned i dele vha. views.


Mit problem er nok at da postgresql ikke understøtter en række tæller, så kan jeg ikke se hvordan man skulle kunne linke data imellem et select resultat til en pointtabel.


Mvh
Jesper K. Pedersen


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-07-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *