/****** Script for SelectTopNRows command from SSMS ******/ SELECT B.[LabId] ,[TrayNo] ,B.[BoxNo] ,B.[RackNo] ,M.id,M.Id FROM [BV_OCM].[dbo].[TblBatch] B INNER JOIN [BV_OCM].[dbo].[MstRackBox] M ON B.RackNo = M.RackNo and B.[BoxNo]=M.[BoxNo] where B.Id=85