Subject | Re: [firebird-support] insert into select ... union ... |
---|---|
Author | unordained |
Post date | 2004-10-25T20:09:57Z |
insert into temp_hl7_export_people (person_id)
select temp_hl7_export_tasks.person_id from temp_hl7_export_tasks
union
select temp_hl7_export_pharm.person_id from temp_hl7_export_pharm
union
select people.id from people where person_id != 0 and last_update_stamp >
people.last_ndw_export_stamp
I get 'token unknown: union' at the first one. I can run any chunk of this just fine. I'm using
this to then join back against various tables during an export (multiple parallel datasets,) so I'd
really rather the temp_hl7_export_people table be entirely unique before I start doing that, to
avoid working the engine harder than needed. (The two first temp tables have their own logic
applied ahead of time.) The field types match, number of fields match ... thus my question about
unions during 'insert into'.
Thanks Helen,
-Philip
---------- Original Message -----------
From: Helen Borrie <helebor@...>
select temp_hl7_export_tasks.person_id from temp_hl7_export_tasks
union
select temp_hl7_export_pharm.person_id from temp_hl7_export_pharm
union
select people.id from people where person_id != 0 and last_update_stamp >
people.last_ndw_export_stamp
I get 'token unknown: union' at the first one. I can run any chunk of this just fine. I'm using
this to then join back against various tables during an export (multiple parallel datasets,) so I'd
really rather the temp_hl7_export_people table be entirely unique before I start doing that, to
avoid working the engine harder than needed. (The two first temp tables have their own logic
applied ahead of time.) The field types match, number of fields match ... thus my question about
unions during 'insert into'.
Thanks Helen,
-Philip
---------- Original Message -----------
From: Helen Borrie <helebor@...>
> I'm still trying to figure out what you're doing here...trying to load the------- End of Original Message -------
> output from a union select into another table, I think...
>
> If you just want a "distinct" union set to work with, omit the ALL
> keyword. The default behaviour is to exclude duplicate rows.
>
> ./heLen