Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: M. Akram Bhatti
  Where is M. Akram Bhatti?
 Riyadh
 Saudi Arabia
 M. Akram Bhatti
 To: khubaib khalid
  Where is khubaib khalid?
 HaroonAbad
 Pakistan
 khubaib khalid
 Tags
Subject: RE: slect record
Thread ID: 249039 Message ID: 249042 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Sunday, December 27, 2009 12:48:36 PM         
   


> >
> >
Select Icase(admitted = 1, "Yes", admitted = 2, "No", "") AS Adm_Status From hixi

> >
> > Regards,
> > akram
>
> thanks working

You are welcome!

I would like to suggest that avoid using hard coded values in the select statement instead use LookUp tables.

For example:

Create Table StatusLookUp (id i, desc C(10))
Insert into StatusLookUp Values (1, "Yes")
Insert into StatusLookUp Values (2, "No")

Select t1.*, t2.desc From hixi t1 ;
Left Outer Join StatusLookUp AS t2 On t1.Admitted = t2.id
Into Cursor myCursor

The advantage of having lookup table is:

If you want to change the resulted output e.g "Y" instead of "YES" or "N" instead of "NO", you do not need to go through all your source code and replace the values instead just change in the lookup table.

Regards,
akram

ENTIRE THREAD

slect record Posted by khubaib khalid @ 12/27/2009 12:19:40 PM
RE: slect record Posted by M. Akram Bhatti @ 12/27/2009 12:26:57 PM
RE: slect record Posted by khubaib khalid @ 12/27/2009 12:34:52 PM
RE: slect record Posted by M. Akram Bhatti @ 12/27/2009 12:48:36 PM