Using IIF in sql

Results 1 to 2 of 2

Thread: Using IIF in sql

  1. #1
    Join Date
    Dec 1969

    Default Using IIF in sql

    I have the following sql: (Using Access 2000)<BR><BR>Select Payments.PaymentID, Payments.PaymentAmount, IIF(Payments.PaymentTypeID IN(5,6,7,8,11),PaymentCreditCardName + &#039; &#039; + PaymentCreditCardNumber,&#039;Not Credit Card&#039;) As PaymentInfo<BR>FROM Payments<BR><BR>I want to use ElseIf (of somesort) to continue to evaluate the PaymentTypeID as It could be other payment types (cash, check,etc..) Is there any way I can do this?

  2. #2
    Join Date
    Dec 1969

    Default RE: Using IIF in sql

    You can have additional iif&#039;s like this<BR><BR>Select Payments.PaymentID, <BR> Payments.PaymentAmount, <BR>IIF(Payments.PaymentTypeID IN(5,6,7,8,11),<BR>PaymentCreditCardName + &#039; &#039; + PaymentCreditCardNumber,<BR>IIF(Payments.PaymentTy peID IN(15,16,17,18,111), &#039;bread&#039;,<BR>&#039;Not Credit Card&#039;)) As PaymentInfo<BR>FROM Payments <BR><BR>There is also a switch function, öook it up in the docs.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts