Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Oops! MIN & MAX in SQL commands
Message
From
12/02/2003 07:48:07
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00752219
Message ID:
00752225
Views:
17
>Is this behaviour intentional?
>
>A table exists called DATATABLE and a numeric field NFIELD exists in it. The record pointer is on, say, record #1.
>
>?MAX(NFIELD, 99)
>SELECT MAX(NFIELD, 99) AS COLUMN1 FROM DATATABLE
>
>The first line works fine.
>The second line raises Error 1300 "Function name is missing )."
>
>MIN gives the same error. A pity.
>(I think this has been there since Fox 2xx - any comments?)
>
>Anyone else seen this?
>
>John Burton

MAX() is a special function in a SELECT statement that requires a single argument: the field from which you want to calculate the maximum value within all the records, or within the group of records you combine into a single record in the result set.

As a workaround for what you desire, you could use an IIF:
select iif(nfield>99, nfield, 99) as Column1...
This example is to emulate MAX.

HTH,

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform