Select Maths - Mailing list pgsql-sql
From | Phillip Smith |
---|---|
Subject | Select Maths |
Date | |
Msg-id | 012b01c6a192$1b827730$9b0014ac@ITPhil Whole thread Raw |
Responses |
Re: Select Maths
Re: Select Maths |
List | pgsql-sql |
<div class="Section1"><p class="MsoNormal"><font color="navy" face="Times New Roman" size="2"><span style="font-size:11.0pt;color:navy">Hiagain,</span></font><p class="MsoNormal"><font color="navy" face="Times New Roman"size="2"><span style="font-size:11.0pt;color:navy"> </span></font><p class="MsoNormal"><font color="navy" face="TimesNew Roman" size="2"><span style="font-size:11.0pt;color:navy">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 valuesand functions:</span></font><p class="MsoNormal" style="text-indent:36.0pt"><font color="navy" face="Courier New" size="2"><spanstyle="font-size:11.0pt;font-family:"Courier New"; color:navy">pqty(stock.code) AS "pqty"</span></font><p class="MsoNormal"><font color="navy" face="Times New Roman" size="2"><spanstyle="font-size:11.0pt;color:navy"> </span></font><p class="MsoNormal"><font color="navy" face="Times NewRoman" size="2"><span style="font-size:11.0pt;color:navy">This needs to be rounded up / down to the nearest multiple ofthe <u>purchase unit</u> quantity for that product – It’s Friday afternoon and my head has refused to help me work outthe maths all afternoon!</span></font><p class="MsoNormal"><font color="navy" face="Times New Roman" size="2"><span style="font-size:11.0pt;color:navy"> </span></font><pclass="MsoNormal"><font color="navy" face="Times New Roman" size="2"><spanstyle="font-size:11.0pt;color:navy">Example:</span></font><p class="MsoNormal"><font color="navy" face="CourierNew" size="2"><span style="font-size:11.0pt;font-family:"Courier New";color:navy"> Pqty = 60</span></font><pclass="MsoNormal"><font color="navy" face="Courier New" size="2"><span style="font-size:11.0pt;font-family:"CourierNew";color:navy"> Purchase Unit = 25</span></font><p class="MsoNormal"><fontcolor="navy" face="Times New Roman" size="2"><span style="font-size:11.0pt;color:navy">Pqty needsto be rounded down to 50.</span></font><p class="MsoNormal"><font color="navy" face="Times New Roman" size="2"><spanstyle="font-size:11.0pt;color:navy"> </span></font><p class="MsoNormal"><font color="navy" face="Times NewRoman" size="2"><span style="font-size:11.0pt;color:navy">I guess I’m also asking if I should do this in the Pqty functionor in the SELECT query to optimize the result?</span></font><p class="MsoNormal"><font color="navy" face="Times NewRoman" size="2"><span style="font-size:11.0pt;color:navy"> </span></font><p class="MsoNormal"><font color="navy" face="TimesNew Roman" size="2"><span style="font-size:11.0pt;color:navy">Thanks all – Enjoy your weekends I hope!</span></font><pclass="MsoNormal"><font color="navy" face="Times New Roman" size="2"><span style="font-size:11.0pt;color:navy">Cheers,</span></font><pclass="MsoNormal"><font color="navy" face="Times New Roman" size="2"><spanstyle="font-size:11.0pt;color:navy">-p</span></font></div><br /><p><b>*******************Confidentiality andPrivilege Notice*******************</b><p> The material contained in this message is privileged and confidential to theaddressee. 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 replyemail. <p> Information in this message that does not relate to the official business of Weatherbeeta must be treatedas neither given nor endorsed by Weatherbeeta. Weatherbeeta, its employees, contractors or associates shall not beliable for direct, indirect or consequential loss arising from transmission of this message or any attachments <br />