>dear Experts,
>
>i have a sql Statement and i m trying to retrieve 'Pindes' from pin file matching with
>piccodes in the current table like as follows.
>
>Select Table1.FirstName As Fname ,Table1.SecondName As SName, (CASE WHEN Len(Table1.pinCode) > 0 THEN (Select Table2.PinDes From Table2 Where Table1.PinCode = Table2.PinCode) ELSE Table1.City END) as PinDet
>
>But while executing it, it gives error
>please anybody helpe me to correct it.
>Thanks in advance
>
>Regards
>Abdulla
Abdulla,
This is ANSI SQL 92 syntax. VFP SQL is not fully ANSI compatible.
Select Table1.FirstName As Fname ,;
Table1.SecondName As SName, ;
iif(Len(Table1.pinCode) > 0, Table2.PinDes, Table1.City) as PinDet ;
from Table1 ;
left join table2 on Table1.PinCode == Table2.PinCode
Cetin