Skip to content
Advertisement

Finding highest reached threshold

I have a table that contains 2 columns that store values of certain thresholds that can be reached. The table columns are: ThresholdValue (INT), Reached (BIT) and the table looks like this:

I need to update the reached column according to the reached threshold. For example, when the reached value is 25000 I want the second row to be set to 1 so it looks like this

What is the easiest way to solve this problem? Any tips will be strongly appreciated

Advertisement

Answer

You can use a subquery to identify the row:

Another approach would look at the next value:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement