PostgreSQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesPostgreSQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old April 30th, 2008, 08:13 AM
bmoddo bmoddo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 2 bmoddo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 30 sec
Reputation Power: 0
Postgresql replacement for dense_rank()??

Hi,

I'm new to the forums here, though I admit to being a 'lurker' for some time now... anyhow...

I'm porting a database from MS-SQL to PostgreSQL and have run into a bit of a stumper; in MS-SQL we use DENSE_RANK() to, well... rank the users of the system based on the number of times a user has accessed the system and 'done' things. ( BTW: The rest of the migration has gone quite well... tables, functions etc. have all been ported to PostgreSQL with little to no fuss)... it's just this DENSE_RANK() thing that has me stumped for the moment.

I've been looking around and trying a few things; temp tables, sub-queries etc. but have yet to come up with a satisfactory replacement for MS-SQL's DENSE_RANK() in PostgreSQL.

Is there a PostgreSQL way to provide the same results as MS-SQL's DENSE_RANK()?

b/.

Reply With Quote
  #2  
Old April 30th, 2008, 11:07 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,687 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 5 Days 17 h 59 m 31 sec
Reputation Power: 259
Unfortunately "window" functions are still in the works for PostgreSQL, you might try this solution

Reply With Quote
  #3  
Old April 30th, 2008, 11:25 AM
shammat shammat is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2003
Location: Munich, Bavaria
Posts: 963 shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 15 h 15 m 49 sec
Reputation Power: 57
Quote:
Originally Posted by pabloj
Unfortunately "window" functions are still in the works for PostgreSQL
Sadly enough.
Too my surprise this is not even available in Postgres Plus (aka EnterpriseDB) even though they claim Oracle compatibility

Reply With Quote
  #4  
Old April 30th, 2008, 02:16 PM
bmoddo bmoddo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 2 bmoddo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 30 sec
Reputation Power: 0
Quote:
Originally Posted by shammat
Sadly enough.
Too my surprise this is not even available in Postgres Plus (aka EnterpriseDB) even though they claim Oracle compatibility


On the whole I'd say the Postgres experience has so far been a good one. I have to admit though that I am somewhat 'tainted' by the facilities found in MS-SQL. There are some very nice tools in there that I'm missing. This is one of them in that right now it's something I need to actually think about as opposed to just using a function that is at my fingertips.

I'll get over it...

Thanks for the link BTW., Very interesting and a step in the direction I think I need to go.

b/.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesPostgreSQL Help > Postgresql replacement for dense_rank()??


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway