Skip to main content
Participant
September 18, 2006
Question

Joining Tables

  • September 18, 2006
  • 1 reply
  • 396 views
I am trying to join five different tables. This table should give me all the equipment that belongs to each employee. But instead, I am getting only the information of those employees that have all the equipment (PC, Laptop, printers and blackberry), NOT the information of all of the employees no matter if they have equipment or not. Here is what I'm doing.

SELECT [Employees].[EMPLOYEE_ID], [Employees].[FIRSTNAME], [Employees].[LASTNAME], [Employees].[OFFICE_ID], [PC].[PC_BARCODE], [Laptops].[LAPTOP_BARCODE], [Blackberries].[BLACKBERRY_BARCODE], [Printers].[PRINTER_BARCODE]
FROM (((Employees INNER JOIN Blackberries ON [Employees].[EMPLOYEE_ID]=[Blackberries].[EMPLOYEE_ID]) INNER JOIN Laptops ON [Employees].[EMPLOYEE_ID]=[Laptops].[EMPLOYEE_ID]) INNER JOIN PC ON [Employees].[EMPLOYEE_ID]=[PC].[EMPLOYEE_ID]) INNER JOIN Printers ON [Employees].[EMPLOYEE_ID]=[Printers].[EMPLOYEE_ID];

Any help will be appreciate it!
This topic has been closed for replies.

1 reply

Inspiring
September 19, 2006
You need outer joins. Inner joins only return records with matching data
Inspiring
September 20, 2006
Amarita,

Try the attached code.

Oh, and also try to use aliases in your queries, they wont be quite so wordy...

Swift