Solved How to check for nearest approx number

Kayleigh

Member
Local time
Today, 12:25
Joined
Sep 24, 2020
Messages
709
Hi,

I have a database which calculates quotes for materials required based on the measurements entered (length and width).
They now would like to include a table with what they currently have in stock.
Then when entering the measurements it should check in the stock table if any length/width are within 20mm.

Any suggestions on how to design the logic here?

Ps. On further consideration I'm thinking along the lines of iterating through the table after update of measurements and checking if each is more or less than 20mm. Is this the best option?
 
Last edited:
without knowing the table design I would speculate something like

select *
from tblstock where length between requiredlength-20 and required length+20
And width between requiredwidth-20 and requiredwidth+20
 
Not sure what your stock consists of but shouldn't there be a third dimension like depth or thickness?
 
I'm not sure what line of work you are in, but for construction, "shorts" are not useful. You need exact-measure or longer. You can always take a longer piece and make it shorter. You can't take a shorter piece and make it longer. So can you explain what kind of business this is that allows "shorts"?
 

Users who are viewing this thread

Back
Top Bottom