Re: [GENERAL] Finding rank of a single record

2010-11-07 Thread Rob Sargent
Alexander Farber wrote: And: pref=> select * from ( select u.id, u.first_name, u.city, m.money, rank() over (order by money desc) from pref_users u, pref_money m where m.yw=to_char(current_timestamp, '-IW') ) ar where ar.id='OK1382399

Re: [GENERAL] Finding rank of a single record

2010-11-07 Thread Alexander Farber
And: pref=> select * from ( select u.id, u.first_name, u.city, m.money, rank() over (order by money desc) from pref_users u, pref_money m where m.yw=to_char(current_timestamp, '-IW') ) ar where ar.id='OK138239987797'; works, but deliver

Re: [GENERAL] Finding rank of a single record

2010-11-07 Thread Alexander Farber
Sorry Rob, but it fails with: pref=> select * from ( select u.id, u.first_name, u.city, m.money, rank() over (order by money desc) from pref_users u, pref_money m where m.yw=to_char(current_timestamp, '-IW') ) all_ranks ar where ar.id='OK

Re: [GENERAL] Finding rank of a single record

2010-11-06 Thread Rob Sargent
Alexander Farber wrote: Hello, I have 2 tables with user infos (please see \d output at the bottom) and would like to find their rank depending on their "money". When I select all records, the rank() works fine: pref=> select u.first_name, u.city, m.money, rank() over (order by money desc) fro

[GENERAL] Finding rank of a single record

2010-11-06 Thread Alexander Farber
Hello, I have 2 tables with user infos (please see \d output at the bottom) and would like to find their rank depending on their "money". When I select all records, the rank() works fine: pref=> select u.first_name, u.city, m.money, rank() over (order by money desc) from pref_users u, pref_money