Re: [GENERAL] left join count

2010-02-11 Thread Greenhorn
On 12 February 2010 10:28, Richard Huxton wrote: > On 11/02/10 22:53, Greenhorn wrote: >> >> But I seem to be getting (after the join) the sum of amount x count of >> notes.  Can someone enlighten me with this problem? > >> select >>   energy_accounts_id, count(note) >>   ,sum(case when t.fin_year

Re: [GENERAL] left join count

2010-02-11 Thread Richard Huxton
On 11/02/10 22:53, Greenhorn wrote: But I seem to be getting (after the join) the sum of amount x count of notes. Can someone enlighten me with this problem? select energy_accounts_id, count(note) ,sum(case when t.fin_year = 2010 and t.fin_quarter = 1 then t.total_amount else 0 e

[GENERAL] left join count

2010-02-11 Thread Greenhorn
Hi All, I'm trying to retrieve the count of notes associated for each transactions for table energy_transactions. But I seem to be getting (after the join) the sum of amount x count of notes. Can someone enlighten me with this problem? Here's the query that I am working with. select energy_acco