simple join is beating me - Mailing list pgsql-sql

From Gary Stainburn
Subject simple join is beating me
Date
Msg-id 200907131134.14335.gary.stainburn@ringways.co.uk
Whole thread Raw
Responses Re: simple join is beating me
List pgsql-sql
hi folks

i have the following:

select o_ord_date as o_date, count(o_id) as orders   from orders where o_de_id in (5,6) and o_ord_date >
CURRENT_DATE-'1
 
month'::interval   group by o_ord_date
order by o_date desc

and

select o_act_del_date as o_date, count(o_id) as delivery    from orders    where o_de_id in (5,6) and
o_act_del_date> CURRENT_DATE-'1 month'::interval and         o_act_del_date <= CURRENT_DATE   group by o_act_del_date
 
order by o_date desc

These give me
  o_date   | orders
------------+--------2009-07-10 |      42009-07-09 |      52009-07-08 |     122009-07-07 |      52009-07-06 |
22009-07-03|      22009-07-02 |      72009-07-01 |     192009-06-30 |     202009-06-29 |     28
 

and 
  o_date   | delivery
------------+----------2009-07-13 |        52009-07-10 |        32009-07-09 |        42009-07-08 |        22009-07-07 |
      42009-07-06 |        72009-07-03 |        62009-07-02 |        52009-07-01 |        32009-06-30 |        3
 

How do i get
  o_date   | orders | delivery
------------+--------+----------2009-07-13 |        |        52009-07-10 |      4 |        32009-07-09 |      5 |
42009-07-08 |     12 |        22009-07-07 |      5 |        42009-07-06 |      2 |        72009-07-03 |      2 |
62009-07-02|      7 |        52009-07-01 |     19 |        32009-06-30 |     20 |        3
 
-- 
Gary Stainburn
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000    


pgsql-sql by date:

Previous
From: "Surajit Bhattacharjee"
Date:
Subject: function returning a cursor and a scalar
Next
From: Oliveiros
Date:
Subject: Re: simple join is beating me