Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select with case when
Message
 
To
07/06/2001 08:24:11
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:
00525177
Views:
13
Thanks All,

Sorry for the delay in replying with my results but it's been busy.


select d.comp_no, d.name, d.classorder, d.memo, d.dam1, ;
iif(classorder = "A","A+",;
iif(classorder = "B","A",;
iif(classorder = "C","A-",;
iif(classorder = "D","B+",;
iif(classorder = "E","B",;
iif(classorder = "F","B-",;
iif(classorder = "G","C+",;
iif(classorder = "H","C",;
iif(classorder = "I","C-"," "))))))))) as grade, ;
m.sire1, m.yr_bred, m.yr_foaled, m.sex, m.color, ;
m.sire2, m.dam2 ;
from description d, master m ;
where &mgrade &msire &myear ;
d.comp_no = m.comp_no order by &morder ;
into cursor sys(2015)




>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
Previous
Reply
Map
View

Click here to load this message in the networking platform