Home > Archive > PostgreSQL SQL > March 2006 > generate_series to return row that doesn't exist in table...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author generate_series to return row that doesn't exist in table...
MaXX

2006-03-24, 8:26 pm

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 in order to plot the data
"2006-03-24 03:00:00+01";55
"2006-03-24 04:00:00+01";33[color=darkred]
"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 used generate_series to get all the timestamps I need but I don't know how
to write my query.


I've tried various combination of subselects, joins, union,... and I never
managed to get the result I wanted... I'm sure the solution is trivial but I
don't get it...
I prefer to generate missing rows "on the fly" intead of actually storing
useless data on the table.

Thanks for your help,
--
MaXX

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com