I need to get some data from two tables, 1 people, 2 tasks, The following query in SQL works, and Access does not work
SELECT Task_Id,
e2.emploeey_name AS W_FROM,
e1.emploeey_name AS W_TO,
t.Task_Details
FROM tasks AS T
INNER JOIN Employees AS e1 ON e1.Emploeey_id = T.Task_To
INNER JOIN Employees AS e2 ON e2.Emploeey_id = T.write_From
I tried many ways, and I searched in Google and I did not find an answer If anyone has a solution I would appreciate it very
You create an inner join by dragging a field from one data source to a field on another data source. Access displays a line between the two fields to show that a join has been created. The names of the tables from which records are combined.
Multiple inner joins in SQL are a common requirement for queries and are possible in SQL. You can add a join keyword to your query, specify the table and then the columns to join on. You can join many tables into a single query to get all of the data you need.
Four types of joins: left, right, inner, and outer.
Inner Join can for sure return more records than the records of the table. Inner join returns the results based on the condition specified in the JOIN condition. If there are more rows that satisfy the condition (as seen in query 2), it will return you more results. Reference: Introduction to Join – Visual Explanation.
Have you tried it with parentheses? MS Access requires (i.e. likes) parentheses around multiple JOINS:
SELECT Task_Id,
e2.emploeey_name AS W_FROM,
e1.emploeey_name AS W_TO,
t.Task_Details
FROM
(
tasks AS T
INNER JOIN Employees AS e1
ON e1.Emploeey_id = T.Task_To
)
INNER JOIN Employees AS e2
ON e2.Emploeey_id = T.write_From
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With