Using evaluate() may impact less on performance. SELECT f1, f2, evaluate("max(f5,f6)") as test FROM t1......
Gianni ----- Original Message ----- From: Ed Leafe <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Sent: Wed, 20 Jun 2007 09:26:20 -0400 Subject: Re: Select statement with a max() of 2 values On Jun 20, 2007, at 9:20 AM, Tristan Leask wrote: > I have got a strange one here. I have written a SELECT statement > which > is something similar to.... > > SELECT f1, f2, max(f5,f6) as test FROM t1...... > > This looks ok to me, however when I try to run it, foxpro doesn't like > the fact that I am using the MAX() function. Apparently when MAX() is > used in a SELECT statement it wants to calculate the maximum of the > specified column. Thus can you not use MAX() to calculate the maximum > of some fields in a row, E.g. MAX(f1, f2, f3, f4)? Why not create a little UDF, and use that in the SQL? FUNCTION FoxMax(p1, p2) RETURN MAX(p1, p2) SELECT f1, f2, FoxMax(f5,f6) as test FROM t1...... -- Ed Leafe -- http://leafe.com -- http://dabodev.com [excessive quoting removed by server] _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.