About Div - Mailing list pgsql-sql

From Otniel Michael
Subject About Div
Date
Msg-id 20060725075726.47735.qmail@web53211.mail.yahoo.com
Whole thread Raw
Responses Re: About Div  ("Aaron Bono" <postgresql@aranya.com>)
List pgsql-sql
Dear All,<br /><br />I have a problem with this case :<br /><br />I have 10 candy for 7 child (A, B, C, D, E, F, G).<br
/><br/>Table X :<br />code   value<br /> -------  -------- <br /> A        0        <br /> B        0        <br /> C 
     0        <br /> D        0        <br /> E        0        <br /> F        0        <br /> G       0        <br
/><br/>And I want divide it with this algorithm : <br />    A = 10 / 7 = 1<br />    B = (10-1) / (7-1) = 9 / 6 = 1<br
/>   C = (10-2) / (7-2) = 8 / 5 = 1<br />    D = (10-3) / (7-3) = 7 / 4 = 1<br />    E = (10-4) / (7-4) = 6 / 3 = 2<br
/>   F = (10-6) / (7-5) = 4 / 2 = 2<br />    G = (10-8) / (7-6) = 2 / 2 = 2<br /><br />In my first solution i use loop
-for each record in my function.<br />But it is too slow in a lot of data.<br />Did postgresql have a function for my
case?<br/><br />Thanks All.<br /><br /><br /><div style="text-align: center;"><span style="color: rgb(0, 128, 255);
font-style:italic;">-- </span><br style="color: rgb(0, 128, 255); font-style: italic;" /><span style="color: rgb(0,
128,255); font-style: italic;">"He who is quick to become angry will commit folly, and a crafty man is hated"
</span><br/></div><p><hr size="1" />Do you Yahoo!?<br /> Everyone is raving about the <a
href="http://us.rd.yahoo.com/evt=42297/*http://advision.webevents.yahoo.com/handraisers">all-new Yahoo! Mail Beta.</a> 

pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: CREATE TABLE AS inside of a function
Next
From: "Aaron Bono"
Date:
Subject: Re: About Div