Solved

need to modify a select statement

Posted on 2012-03-13
2
252 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
[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
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how the fundamental information of how to create a table.

742 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