Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00232621
Message ID:
00232640
Views:
16
Hi Jeff,

If you are executing SQL against VFP tables, (not SQL Pass Through) you can include the iif() in the field list:

SELECT iif(x = 0, 0, y/x) as pct ...

but from your question it sounds like you may want to use the SQL MAX() function instead. For example, if I want the latest date for a patient visit I would code:
SELECT PatientId, MAX(VisitDt) FROM table GROUP BY PatientId

>Does anyone know how I can implement IIF statements in an SQL. I am running a SQL select statement that looks for the patient id but the problem arises when the patient has two different visit dates to the doctor. but I only need the latest date.
>
>Jeff T.

HTH,
Bill Armbrecht
VFP MCP
Previous
Reply
Map
View

Click here to load this message in the networking platform