i have data in below table
Create table #tbl_ContD (D_ID int,CID int,C_Weight int, I_ID int)
insert into #tbl_ContD values (10001 ,20153,200,54)
insert into #tbl_ContD values (10022 ,20153,300,null)
insert into #tbl_ContD values (10033 ,20153,400,15)
i want to filter record using below query .
select Top(1) D_ID,C_weight from #tbl_ContD where CID=20153 and I_ID is null
then insert above record D_ID and C_Weight into #tbl_Issuance_Rags like below
Create table #tbl_Issuance_Rags (R_ID int,D_ID int,R_Weight int,R_Date date,R_QTY int,E_Date date,R_Belt varchar)
insert into #tbl_Issuance_Rags values (1111,10022,300,'2022-11-15',1,'2022-11-15','G')