[SQL] Capture insert returning

2011-04-08 Thread scorpdaddy
Considering jdbc to pg8.4, is there a way to save results of "INSERT ... RETURNING *" to a temp table within the transaction, knowing that INSERT RETURNING is a pg specific augmentation to standard SQL. This doesn't seem to work: CREATE TEMP TABLE bar ON COMMIT DROP AS INSERT INTO foo(a, b

Re: [SQL] Aggregates puzzle

2011-04-08 Thread msi77
Try this: select * from flood_ts F join (SELECT lid, MAX(value) AS mvalue, event_id FROM flood_ts GROUP BY lid, event_id) X on F.lid = X.lid and value = mvalue and X.event_id = F.event_id 01.04.2011, 00:15, "Mark Fenbers" : > SQL gurus, > > I have a table with 4 columns:  lid(varchar), value(flo