After discussion here we've come up with :

SELECT a, ((SIGN(b-c)+1)*b + (SIGN(c-b)+1)*c)/2 FROM xx

Anyone got anything simpler ??

Stephen 


>Hi All

>This should be simple, but I have a mental block ATM.  I'm using MSS SQL 7.

>With a table : CREATE TABLE xx ( a int, b int, c int )
>I want to run: SELECT a, fn(b, c) FROM xx
>where fn(b,c) returns the larger of the values in columns b and c.

>How do I write the select?

>TIA 

>Stephen
---------------------------------------------------------------------------
  New Zealand Delphi Users group - Offtopic List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe offtopic"
Web Archive at: http://www.mail-archive.com/offtopic%40delphi.org.nz/

Reply via email to