On 7/7/06, Phillip Smith <[EMAIL PROTECTED]> wrote:

Same SELECT query as before, different area of it… I have a function that calculates the recommended purchase order quantity for a stock item based off various other values and functions:

pqty(stock.code) AS "pqty"

 

This needs to be rounded up / down to the nearest multiple of the purchase unit quantity for that product – It's Friday afternoon and my head has refused to help me work out the maths all afternoon!

 

Example:

     Pqty = 60

     Purchase Unit = 25

Pqty needs to be rounded down to 50.

 

I guess I'm also asking if I should do this in the Pqty function or in the SELECT query to optimize the result?


select 25 * round(cast(60 as double precision) / 25)

Reply via email to