How to get Name from second table by referring ID from fist table : I am new to the SQL Server world. I've two tables for example

**gameDetails(gid,name,categoryid,companyid,year)** and 

**gameSubDetails(id,name,delflag).**

In gameDetails i've stored ids of gameSubDetails in categoryid and companyid. Now if I want to search any value in gameDetails based on the criteria also from gameDetails, How can I get the name of the Category and Company from gameSubDetails.

For Example I want to search all the values of gameDetails where year=2015.
So I wrote query as
 `select g.gName,gsub.name as catid,gsub.name as compid from gameMaster g,gameSubDetails gsub where g.compid=gsub.id and g.year='2015'`
But i shows only company name in both(catid,compid), but even if i try to put another where condition with catid like `where g.compid=gsub.id and and g.catid=gsub.id and .year='2015'` It does not give me any records. 

Please suggest what is the best way to work upon this scenario.

Note : CategoryId and CompanyID are stored in same table gameSubDetails just Id is different.