Finding value in ranges
Posted by: Ben D
Date: October 27, 2022 12:13PM

Hi All,

I have a table named distribution_details with the following structure and am including just a small subset of rows to try and help explain my issue.

| id |	| max_days |	| pct_to_management_company |
-----------------------------------------------------
  10	  3	          95.00
  1	  10	          90.00
  4	  30	          80.00
  6       45              75.00

I need to get the value that is in pct_to_management_company column based on a value(calculated using TIMESTAMPDIFF() that returns the number of days) that falls within the max_days column

So if I get a value of 4 returned by TIMESTAMPDIFF() I would need to find the row where 4 would be in a specific range. In this instance where max_days > 3 AND max_days <= 10

There could be an infinite number of rows here and I'm just not sure how I can get a bunch of different ranges to see where this number would fall into. Would this even be possible with just a query?

Thanks,
Ben

Options: ReplyQuote


Subject
Written By
Posted
Finding value in ranges
October 27, 2022 12:13PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.