Skip to main content

Hello

How to simply perform a sql operation of union of 2 different database tables ? (not a join)

thanks

Hi @jerome,

Two easy ways of doing so in FME:

1) Use the SQLCreator transformer to do the Union using SQL in the database

2) Read both tables and lead the output to the first transformer or writer. If you need a UNION and not UNION ALL, you will need to filter out the duplicates by using the DuplicateFilter transformer.

Hope this helps.


Thanks... I tried the first solution but it failed because I could not write the correct table 's name from different database. And for the second one I obtain too much different column attribut...

I try again


InlineQuerier: works for me. Union Statement.

I've found that dropping schema prefixes sometimes helps with naming-if possible. So for instance dbo.tableX may not work in some transformers but if you change it at the reader level to come in as tableX it works fine.


InlineQuerier: works for me. Union Statement.

I've found that dropping schema prefixes sometimes helps with naming-if possible. So for instance dbo.tableX may not work in some transformers but if you change it at the reader level to come in as tableX it works fine.

this transformer seems to be dedicated to SQLite database tables.

 

 


Do you know a documentation dedicated to multi database access ?


InlineQuerier: works for me. Union Statement.

I've found that dropping schema prefixes sometimes helps with naming-if possible. So for instance dbo.tableX may not work in some transformers but if you change it at the reader level to come in as tableX it works fine.

It may use SQLite syntax but you can use it with a variety of result sets. I have used it with Oracle, MSSQL, CSV and Excel result sets. Feed your results into the InlineQuerier the create the statement.

In the eaxmple below I use a MSSQL DB and join a spreadsheet with 'union all':

 


It may use SQLite syntax but you can use it with a variety of result sets. I have used it with Oracle, MSSQL, CSV and Excel result sets. Feed your results into the InlineQuerier the create the statement.

In the eaxmple below I use a MSSQL DB and join a spreadsheet with 'union all':

 

Thanks it's just what I want ... but I'm surprised there is no native way to do the sql union operation


@jerome

  1. UNION or UNION ALL is the "native" way to append SELECT statement results together within SQL syntax
  2. In FME, that same can also be achieved with Features by connecting them to a common Transformer, such as a Junction, AttributeManager etc. like so. In the example below, if there are 200 Features coming in from "HeadMeters" and 100 Features coming in from "Properties, then 300 Features will enter and exit the AttributeManager


Reply