SELECT secondCat.Name sname, secondCat.ID sid, secondCat.f_firstCat_ID fid, firstCat.ID fid, firstCat.Name fname FROM divasql7.secondCat JOIN divasql7.firstCat ON firstCat.ID = secondCat.f_firstCat_ID WHERE secondCat.ID = ''