Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
akpaga
Constraint Violating Yak Guru
331 Posts |
Posted - 2011-08-09 : 11:16:45
|
| Hi allI have a table Customers in the following dataCustomer_Type, Max_value , PointsRegular , 1, 100Regular ,5,50Regualr,15,25Monthly,20,500Monthly,10,100Monthly,5,50max value 1 means it is a range 0-1max value 2 means range 2-5 so so onni wnat to use this table as control tableSo when i have a value 3 for regualr customer his score is 50 since it falls betweenn 2-5 and max_value 5 is 50How can i compare the value of 3 wih max vlaue to get the score... |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-09 : 12:21:57
|
something likeSELECT TOP 1 *FROM TableWHERE Max_Value >= @valueAND Customer_Type = @typeORDER BY Max_Value ASC pass suitable values for @type and @value to get max value record------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|