Solved

How to prevent the 0 with a Ladder type payout

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

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

759 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

21 Experts available now in Live!

Get 1:1 Help Now