English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Can someone please explain in english what creates the PMTTYPE field from the IF statement within the followin SELECT statement. I dont know SQL and appreciate all u brains out there!

"SELECT DISTINCTROW IIf(IsNull(MailinSource.MailinSourceID),"No Source Entered",Trim(Trim(Str([SourceNo])) & " " & [Description])) AS SourceDesc, MailinSource.Description, Val(Trim(Trim(Str([SourceNo])) & " " & [Description])) AS ValDesc, IIf([Prepaid],"Prepay",IIf([Receipts].[DowntownCash],"DCR",IIf([PaymentTypes].[PaymentType]="Cash","Cash",IIf([Receipts].[Mailin] And ([HeadOffice]=True),"Mail","Non")))) AS PmtType, Sum(([ReceiptsID]<=CLng(nz([RelatedReceipt],[ReceiptsID])))*-1) AS ReceiptCount, Sum(Receipts.ServiceCharge) AS SumOfServiceCharge, Receipts.MailinSourceID, Sum(IIf([DowntownCash],[AmountSubmitted],[TotalTax])) AS Expected, Locations.Location, Locations.LocationID"

2007-02-05 02:28:14 · 2 answers · asked by justaguyaskingaquestion 1 in Computers & Internet Programming & Design

2 answers

It's kinda chopped off, but I'll try:

It's not an IF statement, it's an IIF statement. The difference is, IIF means 'if (true) then A else B' So PmtType is "Prepay" if Prepaid is true, otherwise it is one of two other things (which I can't see b/c it's chopped off). Hope that helps.

2007-02-05 02:57:55 · answer #1 · answered by Pfo 7 · 0 0

PmtType is only the caption (alias) of column in the result set, which will contain values that return by IIF statement.

2007-02-06 06:13:09 · answer #2 · answered by Serge M 6 · 0 0

fedest.com, questions and answers