Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Statement Help
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01574323
Message ID:
01574329
Views:
76
>>
>>Select R.*, case when U.cntUsers > 1 then 'Multiple' else UserID end as UserId,
>> case when C.cntCompanies>1 then 'Multiple' else Company_id end as Company_id
>>from CallReports R
>>LEFT JOIN (select CallReport_id, min(UserId) as UserId, count(UserID) as cntUsers 
>>FROM  CallReport_Users GROUP BY CallReport_ID) U
>>ON R.CallReport_id = U.CallReport_Id
>>LEFT JOIN (select CallReport_id, min(Company_Id) as Company_Id, count(Company_ID) as cntCompanies 
>>FROM  CallReport_Companys GROUP BY CallReport_ID) C
>>ON R.CallReport_id = C.CallReport_Id
>
>
>Hmm,
>this is syntax for SQL Server :-)

Right, indeed. But if Russell needs it for VFP, it is very easy to convert by changing case statement to IIF and adding ; at the end of the line.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform