Solved

need to modify a select statement

Posted on 2012-03-13
2
246 Views
Last Modified: 2012-03-28
Hi experts,
I need to modify the following case statement:
CASE WHEN AVG(I.Invoice_Amt)>MAX(cust.Approval_Limit)  THEN 0.75*(MAX(I.Invoice_Amt)) ELSE MAX(cust.Approval_Limit) END AS RecApprovalLimit

At THEN 0.75*(MAX(I.Invoice_Amt)) - I should also make sure 0.75*(MAX(I.Invoice_Amt))  doesnot exceed 50000, how do I incorporate the logic here, pls help
0
Comment
Question by:sqlcurious
2 Comments
 
LVL 11

Accepted Solution

by:
SANDY_SK earned 500 total points
ID: 37716745
try this

CASE WHEN AVG(I.Invoice_Amt)>MAX(cust.Approval_Limit)  
THEN (   CASE WHEN (0.75*(MAX(I.Invoice_Amt)) )>50000 then 50000 ELSE (0.75*(MAX(I.Invoice_Amt))   END      ) ELSE MAX(cust.Approval_Limit) END AS RecApprovalLimit
0
 

Author Closing Comment

by:sqlcurious
ID: 37778418
thanks
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how the fundamental information of how to create a table.

762 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now