johnnyg123
asked on
Sql Query Lookup based on range
Here is some sample data from 2 sql 2008 tables
CampaignSeg Table
PlayerID Seg LowPoints HighPoints
1 56
Campaign_Seg_LookUp Table
Campaign SegFloor SegCeiling LowPoints Highpoints
280 35 49.99999 5000 6000
280 50 74.99999 7000 8000
280 75 1499.99999 9000 10000
I am trying to write an update query that will populate the Low and high points on CampaignSeg Table from the Campaign_Seg_LookUp Table based on player segment
Using the above sample data, table entry in would be as follows (since 56 between the segfloor of 50 and segceiling of 74.999
Playerid Seg Lowpoints Highpoints
1 56 7000 8000
Please Note: The number of entries in Campaign_Seg_LookUp Table can vary from campaign to campaign along with the ranges so can't really do hard coded case statements
CampaignSeg Table
PlayerID Seg LowPoints HighPoints
1 56
Campaign_Seg_LookUp Table
Campaign SegFloor SegCeiling LowPoints Highpoints
280 35 49.99999 5000 6000
280 50 74.99999 7000 8000
280 75 1499.99999 9000 10000
I am trying to write an update query that will populate the Low and high points on CampaignSeg Table from the Campaign_Seg_LookUp Table based on player segment
Using the above sample data, table entry in would be as follows (since 56 between the segfloor of 50 and segceiling of 74.999
Playerid Seg Lowpoints Highpoints
1 56 7000 8000
Please Note: The number of entries in Campaign_Seg_LookUp Table can vary from campaign to campaign along with the ranges so can't really do hard coded case statements
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@Author - have you checked the query given the expert above or you need more help on this?