I have two tables in a MS SQL Server database:
Table1
Emp_ID, First_Name, Last_Name
1 Joe Smith
2 Bob Jones
Table2
Emp_ID, Dept_ID, Status
1 1 Active
1 2 NotActive
1 3 NotActive
2 1 Active
What I would like to do is create a SQL select statement that displays a row for every employee and department combination along with the status even if the employee has never been in the department (table 2). For the sample data, this should bring back 6 records since there are 2 employees and 3 departments.
Any help would be appreciated!
SELECT * FROM TableA CROSS JOIN TableBolder style syntax would beSELECT * FROM TableA, TableBbut I would stick with cross join to follow a more current standard. Join Help: blog.codinghorror.com/a-visual-explanation-of-sql-joins