Search Postgresql Archives

Re: select max()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok, it is

# select id from pref_money where money in (select max(money) from
pref_money group by yw);
       id
----------------
 DE8048
 VK91770810
 DE7115
 OK252342810632
 OK228530000997
(5 rows)

And to see how many times a player has won is:

# select count(id) from pref_money where id='DE7115' and money in
(select max(money) from pref_money group by yw);
 count
-------
     1
(1 row)

My only problem is how to prevent false positives,
when the money value in 2 months is the same and
in 1 of the months it is the max value, but in the
other month it is not the max value and has another id.
Then the latter id will be falsely indicated as "winner"...

Regards
Alex

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux