Subject | Re: [firebird-support] How to know the months received? |
---|---|
Author | Mark Rotteveel |
Post date | 2011-09-19T09:18:53Z |
On Mon, 19 Sep 2011 01:22:42 -0400, W O
<sistemas2000profesional@...>
wrote:
attribute (link) a payment to one or more specific invoices at the time of
payment. It would also be possible to keep a balance for a customer: item
billed or invoiced decreases the balance, payment received increases the
balance. In general a customer will have a negative or zero balance, unless
he pays in advance. If negative, the last invoice(s) upto the negative
balance are considered unpaid, if positive it simply means the customer has
credit for any future purchases or bills.
As Set already explained, this is too complex and involves too much
heuristics to solve in SQL if you only store 'months received'.
Mark
<sistemas2000profesional@...>
wrote:
> Hello everybodya
>
> In a table I have data about money received from the clients. Sometimes
> client pay more than a month, like this:I would advise you to rethink your design. You would be better of to
>
> Client Date(mm/dd/yyyy) Months received
> ---------------------------------------------
> Alice 01/02/2011 2
> Alice 03/05/2011 3
> Sylvia 01/08/2011 1
> Sylvia 02/06/2011 1
> Sylvia 03/02/2011 1
> Vivian 02/04/2011 1
> Zuny 01/10/2011 1
> Zuny 03/15/2011 3
>
> And I need to get something like this:
>
> Client Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dic
> ----------------------------------------------------------------------
> Alice Yes Yes Yes Yes Yes
> Sylvia Yes Yes Yes
> Vivian Yes
> Zuny Yes Yes Yes Yes
>
>
> How I can get it?. I need to write a Stored Procedure or is it possible
> with
> just a select?
attribute (link) a payment to one or more specific invoices at the time of
payment. It would also be possible to keep a balance for a customer: item
billed or invoiced decreases the balance, payment received increases the
balance. In general a customer will have a negative or zero balance, unless
he pays in advance. If negative, the last invoice(s) upto the negative
balance are considered unpaid, if positive it simply means the customer has
credit for any future purchases or bills.
As Set already explained, this is too complex and involves too much
heuristics to solve in SQL if you only store 'months received'.
Mark