right join problem

From: Greenhorn <user(dot)postgresql(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: right join problem
Date: 2009-10-02 05:33:16
Message-ID: ddcb1c340910012233m41f6161kaac483c04ef4b320@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

I'm trying to retrieve all meter_id from table meter, and for meter_id
without amount, I'd like it to show nothing, 'null'. I've used right
join here but it's not giving me my desired result. Is there another
way to do this? Here's the query I'm trying.

Thanks in advance!

select m.meter_id, mp.meter_id, sum(amount_in_cents) as am
from meter m
right join transaction_mpark mp on (m.meter_id = mp.meter_id)
where date_time between '2009-09-28 00:00:00' and '2009-10-04 23:59:59'
group by m.meter_id, mp.meter_id
order by m.meter_id

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message A. Kretschmer 2009-10-02 05:45:49 Re: right join problem
Previous Message A. Kretschmer 2009-10-02 05:29:16 Re: Need magic for a moving statistic