pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Phillip Smith <phillips@weatherbeeta.com.au>
To: pgsql-sql@postgresql.org
Subject: Select Maths
Date: Fri, 7 Jul 2006 16:53:52 +1000
Message-ID: <012b01c6a192$1b827730$9b0014ac@ITPhil> (raw)

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 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?

 

Thanks all - Enjoy your weekends I hope!

Cheers,

-p



*******************Confidentiality and Privilege Notice*******************

The material contained in this message is privileged and confidential to
the addressee.  If you are not the addressee indicated in this message or
responsible for delivery of the message to such person, you may not copy
or deliver this message to anyone, and you should destroy it and kindly
notify the sender by reply email.

Information in this message that does not relate to the official business
of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta.
Weatherbeeta, its employees, contractors or associates shall not be liable
for direct, indirect or consequential loss arising from transmission of this
message or any attachments

view thread (8+ messages)  latest in thread

Message-ID: <012b01c6a192$1b827730$9b0014ac@ITPhil>
Permalink:  ../012b01c6a192$1b827730$9b0014ac@ITPhil/
Also on:    postgresql.org/message-id/012b01c6a192$1b827730$9b0014ac@ITPhil

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: phillips@weatherbeeta.com.au
  Subject: Re: Select Maths
  In-Reply-To: <012b01c6a192$1b827730$9b0014ac@ITPhil>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox