If you have two table Employee and Department.
- tblEmp - EmpID, EmpName,DeptID are the fields
- tblDepartment - DeptID,DeptName are the fields
Employee and Department table have the foreign key relation.
SELECT * FROM tblEmp e
INNER JOIN tblDepartment d on d.DeptID = e.DeptID
WHERE d.DeptID IN ('1','2')
How to write stored procedure for above statement?
The department id values in where clause IN
statement are dynamic (1,2) or (1,2,3) what ever I will pass them dynamically.