-
Unresolve problem!
Hi!
I have some tables in my database.
I want to know how can I indentify the column that contains
the primary/foreign key for example:
I have 2 tables, one called "employers" that has 2 columns:
Emp_Id and name, and the other table called "salary" and to this table there are several columns that one of them is Emp_Id.
I'm looking for a function that returns the salary table and
the Emp_Id column and the employers table.
(maybe OpenSchema function?)
Thank you
-
The SQL statement you need is:
"SELECT employers.* , salary.* FROM employers INNER JOIN salary ON employers.EmpID = salary.EmpID"
or if you have the EmpID and just want to find 1 matching record:
"SELECT employers.* , salary.* FROM employers INNER JOIN salary ON employers.EmpID = salary.EmpID WHERE employers.EmpID =" & IDToLookFor