/****** 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
Loading
Jay PankhaniyaPosted Jun 6, 2023, 8:42 AM
In the above query, 'dbContext' represents your database context object. You can replace it with the appropriate instance from your code. The query performs an inner join between the TblBatch and MstRackBox tables based on the conditions B.RackNo = M.RackNo and B.BoxNo = M.BoxNo. It then filters the results based on B.Id = 85. Finally, it selects the desired columns (LabId, TrayNo, BoxNo, RackNo, and Id) from the joined result set.