I have two tables like below:

```
TableA --> categoryId(pk), categoryParentId, catName
TableB --> empId(pk), categoryId, empName, empDesignation

```

![enter image description here](https://i.stack.imgur.com/Ru5cy.jpg)

I want to get all `catName` with respective categoryId from `TableA` where `categoryId=2` of `TableB` is equal to `categoryParentId=2` of `TableA`. Please help.

Result:

```
1002   SE
1003   MD

```