Query layer to show two tables as one

211
8
Jump to solution
11-02-2021 08:21 AM
Labels (1)
DougBrowning
MVP Notable Contributor

I am trying to make a query layer that shows two tables in one.  Both tables have the exact same schema.  It is not a join, just want to show the two tables like they are one to the user.  They are in the same SDE.

In SQL I can just do this 

SELECT * FROM [ilPub].[PubDBO].[TERRA], [ilPub].[PubDBO].[LMF]

In ArcMap I get a ambiguous name objectid error.  I have done a ton of searching but only finding joins.

thanks

0 Kudos
1 Solution

Accepted Solutions
ABishop
Regular Contributor III

If you want to write a SQL statement to accomplish this without appending the tables, you can use a UNION

https://mode.com/sql-tutorial/sql-union/ 

Amanda Bishop, GISP

View solution in original post

0 Kudos
8 Replies
ABishop
Regular Contributor III

Hello @DougBrowning 

Try a relate.

Amanda Bishop, GISP
0 Kudos
DougBrowning
MVP Notable Contributor

The two are not related.  Just want to show both.

Table 1

1

2

3

Table 2

7

8

9

Final table

1

2

3

7

8

9

 

Thanks

0 Kudos
ABishop
Regular Contributor III

In order to do this you must have a unique ID that you can either join or relate the tables.

Amanda Bishop, GISP
0 Kudos
DougBrowning
MVP Notable Contributor

They are not to be joined or related.  I just want to see both at once in the same table.  So if I have 1,000 records in table 1 and 500 in table 2 then the result table has 1,500 rows.

Thanks

0 Kudos
ABishop
Regular Contributor III

Do you want them to be permanently this way?  If so, you always append one table to the other.

Amanda Bishop, GISP
0 Kudos
ABishop
Regular Contributor III

If you want to write a SQL statement to accomplish this without appending the tables, you can use a UNION

https://mode.com/sql-tutorial/sql-union/ 

Amanda Bishop, GISP
0 Kudos
DougBrowning
MVP Notable Contributor

Ok it looks like that worked.  thanks a lot

ABishop
Regular Contributor III

You're welcome

Amanda Bishop, GISP
0 Kudos