Re: [GENERAL] 'order by' in an insert into command

2004-09-08 Thread Tom Lane
Richard Huxton <[EMAIL PROTECTED]> writes: > In your example, I would expect the nextval() to be called during the > "fetch", before the ordering. You could probably do something like: > INSERT INTO pending_tnmt_sec > SELECT foo.*, nextval('sec_seq') FROM >( > SELECT tseceventid, ... >

Re: [GENERAL] 'order by' in an insert into command

2004-09-08 Thread Richard Huxton
Mike Nolan wrote: I have the following insert to populate a new table: insert into pending_tnmt_sec select tseceventid, tsecsecno, nextval('sec_seq'), tsecrtddt from tnmtsec order by tsecrtddt,tseceventid,tsecsecno; I need to access this data in a particular order which may change over time but the

Re: [GENERAL] 'order by' in an insert into command

2004-09-08 Thread Jean-Luc Lachance
Try: insert into pending_tnmt_sec select tseceventid, tsecsecno, nextval('sec_seq'), tsecrtddt from ( select tseceventid, tsecsecno, tsecrtddt from tnmtsec order by tsecrtddt,tseceventid,tsecsecno) as ss; Mike Nolan wrote: I have the following insert to populate a new table: insert into pend

[GENERAL] 'order by' in an insert into command

2004-09-08 Thread Mike Nolan
I have the following insert to populate a new table: insert into pending_tnmt_sec select tseceventid, tsecsecno, nextval('sec_seq'), tsecrtddt from tnmtsec order by tsecrtddt,tseceventid,tsecsecno; I need to access this data in a particular order which may change over time but the initial order I