Lui
Lui

Reputation: 53

MS Access SQL Alias in Make table and Union query

Ok, this should (hopefully) be a very basic question. I'm sorry if this is already explained elsewhere; I've spent some time trying to figure this out but all the answers I found were over my head.

I am using Microsoft Access and I just figured out how to make a SQL query that combines my (identically structured) tables into one table with all my data! Hooray! When I ran it, it worked and I'm overjoyed, but when I opened it up in SQL view again, I noticed something interesting. An alias was added to the code, and I don't exactly understand what it's purpose is or if I should be handling it differently. Is this something that I should change or be worried about? Thanks!

Here is the code:

SELECT * INTO [PAB 2018 Test]
FROM (Select * from [PAB 2018 Ind MM 31616] 
Union All 
Select * from [PAB 2018 Ind MM 34102]
Union All 
Select * from [PAB 2018 Ind MM 57129]
Union All 
Select * from [PAB 2018 Ind MM 85736]
Union All 
Select * from [PAB 2018 Ind MM 88102])  AS [%$##@_Alias];

Upvotes: 0

Views: 518

Answers (1)

Sergey S.
Sergey S.

Reputation: 6336

The alias was added by query constructor because in design mode it needs a name for subquery. This name shown as a table/query in constructor. You can change this alias name as you wish in text mode

Upvotes: 1

Related Questions