Solved

How to prevent the 0 with a Ladder type payout

Posted on 2014-07-31
2
26 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
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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.

756 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