Solved

How to prevent the 0 with a Ladder type payout

Posted on 2014-07-31
2
27 Views
Last Modified: 2015-06-04
If I have the tables below and Salesman SalesP sells 42 items and I use a Case Statement of
Case When Items >= S and <= E Then Win else '0' end as Payout I get 3 results 0,0 and 250. Now I know why I get that
but how can I Not get the 0's. Of course if the items were 10 I would want 0, but just one of them?


Salesman table
SalesP      Items
1      42        

Payout table
S      E      Win
30      39      200
40      49      250
50      59      300
0
Comment
Question by:SeTech
[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 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 40231626
<wild guess, not sure there's enough into to answer this question>

SELECT s.SalesP, p.Win
FROM Salesman s
   JOIN Payout p ON s.Items BETWEEN p.S AND p.E
WHERE s.SalesP = 1

Open in new window

0
 
LVL 15

Expert Comment

by:Vikas Garg
ID: 40231629
Hi,

Not very clear with your question..

Can you take some sample data and explain pls ?
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

734 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