Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP-SQL translation
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00749711
Message ID:
00749746
Views:
30
This message has been marked as a message which has helped to the initial question of the thread.
Hi Nadya

May be IIFwas impreded you. I had not tested this, but this is syntax, that you need instead of IIF
SELECT MainInfo.*, ;
sum(CASE MainInfo.Category WHEN "1" THEN 1 ELSE 0) as Category1Count, ;
sum(CASE MainInfo.Category WHEN "2" THEN 1 ELSE 0) as Category2Count ;
from MainInfo inner join NamesInfo ;
on MainInfo.CrediID = NamesInfo.CrediID ;
where MainInfo.ccode = "01" and ;
MainInfo.town in (select Town from SelectedTowns) ;
and NamesInfo.LastName like ?NameInput ;
group by MainInfo.CredID into cursor curResult
>Hi everybody,
>
>How this VFP SQL will look in SQL Server:
>
>SELECT MainInfo.*, ;
>sum(iif(MainInfo.Category = "1",1,0)) as Category1Count, ;
>sum(iif(MainInfo.Category = "2",1,0)) as Category2Count ;
>from MainInfo inner join NamesInfo ;
>on MainInfo.CrediID = NamesInfo.CrediID ;
>where MainInfo.ccode = "01" and ;
>MainInfo.town in (select Town from SelectedTowns) ;
>and NamesInfo.LastName like ?NameInput ;
>group by MainInfo.CredID into cursor curResult
>
>Thanks a lot in advance.
Venelina Jordanova

Outsourcing IT Services Ltd.
Previous
Reply
Map
View

Click here to load this message in the networking platform