Re: [GENERAL] find the greatest, pick it up and group by

2011-05-17 Thread Phil Couling
Hi The method you're using is functionally correct and quite efficient if a little on the verbose side. Other non-postgres variants of SQL have a DECODE function which comes in very handy. I dont believe postgres has any equivalent. (Postgres decode() does something entirely differnt). I often

[GENERAL] find the greatest, pick it up and group by

2011-05-16 Thread Ivan Sergio Borgonovo
I've a table like: CREATE TABLE ordiniitem ( idordine numeric(18,0) NOT NULL, grupposped smallint, idart numeric(18,0) NOT NULL, qevasa integer, qfuoricat integer, qinris integer, qnonpub integer, qann integer, qord integer, qpren integer, qrichpag integer, qinriass

Re: [GENERAL] find the greatest, pick it up and group by

2011-05-16 Thread David Johnston
When asking for help on non-trivial SELECT queries it really helps to tell us the version of PG you are using so that responders know what functionality you can and cannot use. In this case specifically, whether WINDOW (and maybe WITH) clauses available? David J. -Original Message-

Re: [GENERAL] find the greatest, pick it up and group by

2011-05-16 Thread Ivan Sergio Borgonovo
On Mon, 16 May 2011 20:05:45 -0400 David Johnston pol...@yahoo.com wrote: When asking for help on non-trivial SELECT queries it really helps to tell us the version of PG you are using so that responders know what functionality you can and cannot use. In this case specifically, whether WINDOW