Re: [SQL] generate_series to return row that doesn't exist in

2006-03-24 Thread MaXX
On Friday 24 March 2006 21:42, Scott Marlowe wrote: > More than likely you need a left join and a case statement. > > select , case when a.date is null then 0 else a.date end > from (select * from generate_series() -- magic to get dates goes here) > as p left join maintable as a on (p.date=a.date);

Re: [SQL] generate_series to return row that doesn't exist in

2006-03-24 Thread Scott Marlowe
On Fri, 2006-03-24 at 14:30, MaXX wrote: > Hi, > > I have a table wich contains aggregated data, > table stats_activity > logtime timestamptz, > count int > > given this dataset > "2006-03-24 03:00:00+01";55 > "2006-03-24 04:00:00+01";33 > "2006-03-24 06:00:00+01";46 > "2006-03-24 07

[SQL] generate_series to return row that doesn't exist in table...

2006-03-24 Thread MaXX
Hi, I have a table wich contains aggregated data, table stats_activity logtime timestamptz, count int given this dataset "2006-03-24 03:00:00+01";55 "2006-03-24 04:00:00+01";33 "2006-03-24 06:00:00+01";46 "2006-03-24 07:00:00+01";63 "2006-03-24 08:00:00+01";88 I want to get this