|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
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
|
|||
|
|||
|
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/. |
|
#2
|
||||
|
||||
|
Unfortunately "window" functions are still in the works for PostgreSQL, you might try this solution
__________________
My blog about OpenSource Databases PDF tutorials about OSS databases, DBMonster ... Please contribute to Open Source Development, fill bug reports!!! Developer Shed eSupport Commented my.ini/my.cnf (PLEASE ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins |
|
#3
|
|||
|
|||
|
Quote:
Too my surprise this is not even available in Postgres Plus (aka EnterpriseDB) even though they claim Oracle compatibility ![]() |
|
#4
|
|||
|
|||
|
Quote:
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/. |
![]() |
| Viewing: Dev Shed Forums > Databases > PostgreSQL Help > Postgresql replacement for dense_rank()?? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|