Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select with case when
Message
 
To
07/06/2001 08:25:36
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00516210
Message ID:
00516402
Views:
14
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform