There is a table 1 and table 2 with the same name as the composition of the fields.

Is it possible to place the tables one after the other in the request (see screen)?

enter image description here

  • one
    On the screen you have ms-excel and not ms-access . If suddenly you needed to select data from two tables in access and show it in the form of one result, then you will be helped by the union all operator - teran
  • @teran Excel showed for schematics ... I am still mastering access .. Could you show with an example how to implement your proposed solution ... Thank you. - koverflow
  • one
    SELECT 'Табл 1' as tname, * FROM Таблица1 UNION ALL SELECT 'Табл 2' as tname ,* FROM Таблицы2 ORDER BY tname, id something like that, no access. - teran
  • one
    and maybe even so TABLE [Таблица1] UNION ALL TABLE [Таблица2] - teran
  • @teran Works .. Probably make out as an answer ... - koverflow

1 answer 1

Typically, the UNION and UNION ALL operators are used to combine different samples with the same set of fields. The difference between them is that in the second case there are absolutely all the results in the sample, and in the first case there are no duplication.

For your question, you can build the following query:

 SELECT 'Табл 1' as tname, * FROM Таблица1 UNION ALL SELECT 'Табл 2' as tname, * FROM Таблицы2 ORDER BY tname, id 

Since ms-access has several specific SQL syntax, the following syntax is also possible to completely merge a table without filtering the results:

 TABLE [Таблица1] UNION ALL TABLE [Таблица2]