Re: [SQL] Select Maths

2006-07-10 Thread Phillip Smith
To: Phillip Smith Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Select Maths Why wouldn't you be able to do this in a function?  Pass in stock.code, stock.purchase_unit, stock.box_qty and creditors.review_cycle .  You can then use variables in the function, right? -

Re: [SQL] Select Maths

2006-07-10 Thread Aaron Bono
On 7/10/06, Phillip Smith <[EMAIL PROTECTED]> wrote: Example: Funcation pqty(stock.code) calculates a value of 0 for a particular product. This fails the last CASE that makes sure the pqty() value is greater than our Usage Rate * Review Cycle – in this case is 3. But that is less

Re: [SQL] Select Maths

2006-07-10 Thread Phillip Smith
Smith Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Select Maths Can you provide example values and show where it is and is not working?  I am not quite sure what you are trying to do here. -Aaron    ***Confidentiality and Privilege Notice*** The ma

Re: [SQL] Select Maths

2006-07-10 Thread Aaron Bono
On 7/10/06, Phillip Smith <[EMAIL PROTECTED]> wrote: Beautiful – Works a treat. Thanks Aaron.   A follow-on problem now… I have the below column in the select, but I need to validate the value across all 3 rules –  I need to assign it to a variable!!   Example – my pqty function

Re: [SQL] Select Maths

2006-07-10 Thread Phillip Smith
n for all your help guys, -p   -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Bono Sent: Friday, 7 July 2006 18:37 To: Phillip Smith Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Select Maths   On 7/7/06, Phillip Smith <[EMAIL PROTECTED]&g

Re: [SQL] Select Maths

2006-07-07 Thread Aaron Bono
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

Re: [SQL] Select Maths

2006-07-07 Thread Rodrigo De Leon
On 7/7/06, Phillip Smith <[EMAIL PROTECTED]> wrote: Hi again, G'day (it's 03:21 on a friday here). 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(

[SQL] Select Maths

2006-07-07 Thread Phillip Smith
Hi again,   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 multipl