Answer the question
In order to leave comments, you need to log in
How to edit a SQL query?
All greetings
There is a DB on ACCESS. I work with it in a basis through SQL.
Now there is a need to process several tables (WAREHOUSE and Employees)
There are 3 tables
1) Employees
full name | Department
Employee 1 | Department 1
Employee 2 | Department 2
Employee 3 | Department 3
2) System Blocks
Model | Number | Full name
ModelSB 1 | 001 | Employee 1
ModelSB 1 | 002 | Employee 2
ModelSB 2 | 003 | Employee 3
3) Monitors
Model | Number | Full name
ModelM 1 | 001 | Employee 1
ModelM 1 | 002 | Employee 1
ModelM 1 | 003 | Employee
3
We take the filter by "Employee 1"
Employee 1 | ModelSB 1 | 001
Employee 1 | ModelM 1 | 001
Employee 1 | ModelM 1 | 002
Now the output is this way
(
SELECT [Employees of the IE].[Name], [Warehouse 001 System Unit].[Type], [Warehouse 001 System Unit].[Inventory Number], [Warehouse 001 System Unit].[Name], [Warehouse 002 Monitor].[Type], [Warehouse 002 Monitor].[Inv number], [Warehouse 002 Monitor].[Name]
FROM [Employees of IE], [Warehouse 001 System Unit], [Warehouse 002 Monitor]
WHERE [ Employees of the IE].[Name]=[Warehouse 001 System Unit].[Name] AND [Employees of the IE].[Name]=[Warehouse 002 Monitor].[Name] AND [Employees of the IE].[Name] LIKE "*" & [Enter Employee] & "*";
)
Filter by "Employee 1"
Employee 1 | ModelSB 1 | 001 | Employee 1 | ModelM 1 | 001 | Employee 1
Employee 1 | ModelSB 1 | 001 | Employee 1 | ModelM 1 | 002 | Employee 1
How to edit request
Thank you
Answer the question
In order to leave comments, you need to log in
Use UNION
https://support.office.com/en-us/article/%D0%9E%D0...
SELECT [Системные блоки].[ФИО], [Системные блоки].[Модель], [Системные блоки].[Номер]
FROM [Системные блоки]
WHERE [Системные блоки].[ФИО]="Сотрудник 1"
UNION ALL
SELECT Мониторы.[ФИО], Мониторы.[Модель], Мониторы.[Номер]
FROM Мониторы
WHERE Мониторы.[ФИО]="Сотрудник 1"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question