Re: [SQL] new max function

2003-10-17 Thread Tom Lane
Mike Rylander <[EMAIL PROTECTED]> writes: > Here's mine: > CREATE FUNCTION max2 (INTEGER,INTEGER) RETURNS INTEGER > LANGUAGE SQL AS > 'SELECT CASE WHEN $1 > $2 THEN $1 ELSE $2 END'; BTW, most of the standard datatypes have these already, because they are the transition functions for the MAX()

Re: [SQL] new max function

2003-10-17 Thread Mike Rylander
Here's mine: CREATE FUNCTION max2 (INTEGER,INTEGER) RETURNS INTEGER LANGUAGE SQL AS 'SELECT CASE WHEN $1 > $2 THEN $1 ELSE $2 END'; This returns: database=# select max2(1,2); max2 -- 2 (1 row) database=# select max2(3,1); max2 -- 3 (1 row) On Friday 17 October 2003 02

[SQL] new max function

2003-10-17 Thread Rodrigo Gesswein
Hello! I'm looking for a function to calculate the max value from two numbers, something like max2(a,b) with a,b int Does anyone have the trick ? Thank you in advance.. Rodrigo! ---(end of broadcast)--- TIP 3: if posting/reading through