Re: [SQL] join help

2009-04-08 Thread Kashmir
thx for the help! this did it then for an individual collection and its fast :-): SELECT OneM.f_timestamp, FiveM.f_ds, FiveM.f_us, OneM.f_ds, OneM.f_us FROM td_fetch1m_by_rrd_id OneM left join (select f_rrd_id, f_ds, f_us, f_timestamp from td_fetch_by_rrd_id where f_rrd_i

Re: [SQL] join help

2009-04-08 Thread Justin
Kashmir wrote:only difference is: first table stores data per 'f_rrd_id' evey 5min, and the second table every single minute. I want to run a query that would return for the same 'f_rrd_id' all values from both tables sorted by f_timestamp, of course a set would only have values from the 5m

[SQL] join help

2009-04-08 Thread Kashmir
i'm in need of some psql advise, believe its rather a trivial issue, but confusing for me... facing following issue: got 2 tables like: CREATE TABLE td_fetch_by_rrd_id ( f_rrd_id numeric NOT NULL, f_timestamp numeric NOT NULL, f_ds numeric, f_us numeric, CONSTRAINT td_fetch_by_rrd_id_p

Re: [SQL] ENUM vs DOMAIN vs FKyed loookup table

2009-04-08 Thread Peter Eisentraut
On Wednesday 08 April 2009 20:08:55 Mario Splivalo wrote: > What are your practices, when do you use ENUMs and when Domains? When given the choice, pretty much ENUMs. Domains weren't really conceived for this sort of thing in the first place, so it's good to move away from them. -- Sent via p

[SQL] ENUM vs DOMAIN vs FKyed loookup table

2009-04-08 Thread Mario Splivalo
When you need to choose between enum types, domain types or lookup tables with foreign keys, what do you usualy choose? Only recently I started using domains, but that seems to be painful, as Joshua Drake explains here: http://www.commandprompt.com/blogs/joshua_drake/2009/01/fk_check_enum_or_