
Originally Posted by
gpasquali
Hello,
i have two tables:
“Company” and “site” linked between a “ID_company”.
In the “site” table there are information about the “subsidiary” (“type of subsidiary”, address, city, contact email etc).
I need a query to have in a ROW all the information related to a company, for example:
Company_name, .. , subsidiary_name1, address1, city1, contact email_1, subsidiary_name2, address2, city2, contact email_2, ….
Please can you help me????
that means that in 1 row will be all the information of a company.
Here is a simple Query where I joined two tables using a query by itself not actually joining the table in relationships.
Simply open query in design mode and drag ID to ID, right click the line and select option that best decribes which table you want to be primary and not (Most time option 2 is what everyone uses).
Drag in all the fields you want from the two tables into the query and set your criteria, IE: FirstName criteria could be "John"
Here is my sample SQL for my query for you to see.
Code:
SELECT tbl_Customers.CustomerID, tbl_Customers.FirstName, tbl_Customers.ZipCode, tbl_city_zip.City, tbl_city_zip.StateName
FROM tbl_Customers LEFT JOIN tbl_city_zip ON tbl_Customers.ZipCode = tbl_city_zip.ZIPCode
WHERE (((tbl_Customers.FirstName)="John"));
Hope this helps