I would like to know the query for the below mentioned case. I am using SQL Serever 2008.
Table1 | Table2 | |||||
ID | Department | Name | Zip | ID | Department | Country |
1 | a | xx | 10 | 1 | a | qqq |
2 | b | yy | 20 | 3 | c | www |
3 | c | zz | 30 | 5 | e | ttt |
4 | d | cc | 40 |
I want to retrieve those data from table1 which found a match(Id+department) with Table2. The query would return the result as follows:
ID | Department | Name | Zip | Country |
1 | a | xx | 10 | qqq |
3 | c | zz | 30 | www |
Thanks.