[SQL] Pulling additional columns with aggregate

2009-10-08 Thread sub3
Hi, I have 2 tables. I want to be able to calculate the closest value in one (tempvalues), to the closest value in the other (points). This closest point, I want to save into the table with its difference. So if I have: create table points ( id integer, center double precision ); insert i

[SQL] Query to match location transitions

2008-11-14 Thread sub3
Hi, I was hoping someone could help me build a better query. I have a table of time/locations. Occasionally, we have multiple timestamps for the same location. I would like to remove those extra timestamps and only show the transition from one location to another. So... create table time_loca

Re: [SQL] Data into an array

2008-08-26 Thread sub3
Thanks, I got it to work. But now I have a different problem. If I execute: select * from getvss(1, now()) it works. But instead, if I execute it as: select *, getvss(d1.id, now()) from d1 I don't get separate columns for the data coming from getvss, it is all in one column, unlike the previ

[SQL] Data into an array

2008-08-26 Thread sub3
Hi, I am trying to compress some data down into a single row (making it an array). I believe I am close, but I still keep getting an error: "ERROR: query has no destination for result data" Does anyone have an idea what is going wrong? Thanks. CREATE or REPLACE FUNCTION getVSS(f_pvid integer,