Subject | RE: [firebird-support] help on query |
---|---|
Author | Alan McDonald |
Post date | 2003-11-28T02:24:59Z |
> I have a table data like thisdo you mean
>
> unique_id, journal_no, account_id, debit, credit
> 1 1 242 200.00 0.00
> 2 1 234 250.00 0.00
> 3 1 522 450.00
>
> 4 2 525 500.00 0.00
> 5 2 219 0.00 100.00
> 6 2 423 0.00 200.00
> 7 2 332 0.00 200.00
>
> account_id will never repeat under a journal_no.
> Either
> debit or credit will have only one entry.
>
> Please help me to write a SELECT statment which
> returns
> the account_id of the amount which is appearing as a
> total to the multiple entries ( account_id 522 and
> 525 in this example).
>
> Thank you.
>
> Sudheer
select journal_no, account_id, sum(debit, sum(credit) from table1 group by
journal_no, account_id
Alan