Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieving data from multiple tables
Message
From
20/09/2005 04:14:35
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
20/09/2005 03:51:53
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01051149
Message ID:
01051155
Views:
9
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform