James,
Sorry, I didn't understand your question. When I saw your CASE WHEN syntax I assumed that you were using SQL Server as a backend.
In VFP, there's another way to achieve the same result and IMHO a bit easier to read than the many nested IIFs:
Select name, sire1, ;
ceiling(at(grade, "A+A A-B+B B-C+C C-")/2) AS gradeOrder;
from master where grade # " " order by name
HTH
>Hi Cetin,
>
>Okay thanks, I guess I should have windered why I was having trouble finding out anything about the "case when then".
>
>This is the solution, thanks to you.
>
>select name, ;
>sire1, ;
>grade, iif(grade = "A+","1",;
>iif(grade="A","2",;
>iif(grade="A-","3",;
>iif(grade="B+","4",;
>iif(grade="B","5",;
>iif(grade="B-","6",;
>iif(grade="C","7"," "))))))) as gradeorder ;
>from master ;
>where grade # " " ;
>order by name
>
>
>
>
>
>>>
>>>James,
>>>SQL server does that but this kind of case is not allowed in VFP SQL.
>>>You could do something like :
>>>
>>>
Select name, sire1, ;
>>> iif(grade = "A+",1,;
>>> iif(grade = "A",2,;
>>> iif(grade = "B+",3,;
>>> iif(grade = "B",4,;
>>> iif(grade = "A",2,;
>>>))))) as gradeorder from master where grade # " " order by name
Cetin
>>
>>Last grade= "A" ... is a leftover from pasting.
>>Cetin
Daniel