Subject | RE: [firebird-support] table insert into itself - can this be done? |
---|---|
Author | Svein Erling Tysvær |
Post date | 2011-12-14T09:01:32Z |
>In Oracle I frequently use "insert into table_a select * from table_a"Doesn't sound quite logical that Firebird should behave this way, but I don't doubt your observations and think I've observed something similar (although last time I saw a never ending query was when I tried a simple select with GROUP BY on a constant value in Firebird 1.5.4. Though the very same query on a newer Firebird version yielded the correct result).
>to build up some volume in a table. The first time I tried that in
>Firebird, it never finished - I had to kill it.
Haven't tried it, but adding DISTINCT to Davids query:
insert into table_X (mydatetime, taskcode, sitecode)
Select DISTINCT x.mydatetime, x.taskcode, ss.sitecode
From table_X x
inner join sites ss on (ss.siteparentcode=x.sitecode)
Where (x.mydatetime between '30 nov 2010' and '1 nov 2011');
ought to ascertain the query finishes. Although it might not insert as many records as David intended.
HTH,
Set