I have a table with column as and its value as given
ProvisionType——From Days——ToDays
- goodLoan ——— 1——————90
- Substand ————91————–180
- doubful————–181————–365
- bad—————-365—————-365+
IN the following case i may have a variable which may be different and i am managing that from code….But suppose if i want to find where exactly 200 falls between From days and To Days so i get the Correct Provision Type. So please anybody could help me on this
If you’re using SQL Server then this should work. Not sure if MySql has BETWEEN…
It could also be written without the BETWEEN…
For this to work you should replace 365+ on the last provision with an actual number, otherwise the ToDays field will need to be a varchar field rather than numeric. Also, if a value of 365 is provided, would it be expected to fall into the last category or the one before it? The other categories have a distinct cut-off point, but the last ones overlap.