Solved

IIF and Case is SQL through ASP

Posted on 2004-10-07
1
271 Views
Last Modified: 2010-05-19
After reading multiple questions and answers in this forum I've tried a number of solutions to an error from SQL.  
"Incorrect syntax near '>'."

Through changing operator, I've determined it points to the >= in

case tblARInvoices.date when >= '01/12/04'

Prior to using a case expression, I was using IIF but read that this is not supported.  I changed to the CASE and got the same error message.

I'm missing something.

Any help is appreciated.

SQL = "SELECT tblARInvoices.[Invoice#], tblARInvoices.Date, " & _
"tblOEOrders.[Order#], tblCustomers.CustomerName, " & _
"tblInventory.[Part#], tblInventory.Description,  " & _
"tblARInvoiceDetail.SplitAmount AS Sale, " & _
"case tblARInvoices.date when >= '01/12/04' And <='02/29/2004' then '20%' else '10%') end AS Pct, " & _
"case tblARInvoices.date when >= '01/12/04' And " & _
" <='2/29/2004') then [Sale]*0.2 else [sale]*0.1 end AS Accrual, " & _
" case accrual when >5000 then 5000 else accrual AS Earned " & _

0
Comment
Question by:ckausen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 6

Accepted Solution

by:
etmendz earned 50 total points
ID: 12256777
CASE may be used this way:

CASE WHEN tblARInvoices.date >= '01/12/04' THEN ...
...

Observe that tblARInvoices.date is placed after WHEN instead of after CASE. Rewrite your code so that you complete the condition expression inside the WHEN clause...

Have fun.

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question