Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL 7 case-statement vs. VFP IIF
Message
From
28/03/2000 18:01:58
 
 
To
28/03/2000 17:47:19
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00351724
Message ID:
00351734
Views:
22
Hi Edward,

You are not going to get the same exact code to work on both databases. I don't know what the datatype for your local logical field is, but I'll assume its a bit. For T-SQL, try:
SELECT 'receipts'=CASE 
   WHEN auladjrec=1 THEN 0
   ELSE SUM(auyamt)
   END
   'adjtmnts'=CASE
   WHEN auladjrec=1 THEN SUM(auyamt)
   ELSE 0
   END
   FROM araudit ....
...etcetera.........




>The following statement is in my VFP code for SPT Query:
>
>SqlSelect =
>"Select Sum(IIf(ArAudit.AUlAdjRec, 0.0000 ,ArAudit.AUyAmt)) As Receipts,
>Sum(IIf(ArAudit.AUlAdjRec, ArAudit.AUyAmt, 0.0000)) As Adjtmnts
>
>From ArAudit Inner Join ArCharge Inner Join LookUp On ArCharge.CHilookUp = Lookup.lOiID On ArAudit.AuiCharge = ArCharge.ChiId
>
>Group By AUiCharge"
>
>How can I convert these 'Sum(IIf ...)' statements to T-SQL for SQL Server 7 so that it will also work in VFP?
>
>TIA,
>
>Ed
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Reply
Map
View

Click here to load this message in the networking platform