Re: About Div

From: "Aaron Bono" <postgresql(at)aranya(dot)com>
To: "Otniel Michael" <otmic_ie(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: About Div
Date: 2006-07-26 14:49:25
Message-ID: bf05e51c0607260749u43e2104di1d6aa9bd7c90bd86@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 7/25/06, Otniel Michael <otmic_ie(at)yahoo(dot)com> wrote:
>
> Mr. Aaron. I am sorry, your solution didn't match in my case.
> Example for your solution :
> A = 1
> B = 1
> C = 1
> D = 1
> E = 1
> F = 1
> G = 4
>
> G have 4 candy. Its too much for G.
>
> In my case, the solution is :
> A = 1
> B = 1
> C = 1
> D = 1
> E = 2
> F = 2
> G = 2
>
> The extra candy is given to three child.
>
> Do you have the other solution? I need function in postgresql for my case.
> Because my loop is too slow.
>
> Btw thanks for your solution.
>

I think you misunderstood how to use the MOD value. 10 % 7 = 3 so the last
3 people get 1 extra, NOT the last person getting the extra 3.

But it looks like Ross got you the code to fix the problem. Check what he
provided.

==================================================================
Aaron Bono
Aranya Software Technologies, Inc.
http://www.aranya.com
==================================================================

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Aaron Bono 2006-07-26 15:07:53 Re: Storing an ordered list
Previous Message Jonah H. Harris 2006-07-26 04:00:42 Re: SQL generator