sql 使用变量带入in条件

DECLARE @defect_condition_TB TABLE (DefectName NVARCHAR(100));
INSERT INTO @defect_condition_TB (DefectName) VALUES (N'耐久'), (N'光学测定');
SELECT DefectName FROM @defect_condition_TB

select * from T_VP_Defect_DefectMonthlyDetailsList_Orig
where process_name in(SELECT DefectName FROM @defect_condition_TB)

 

posted @ 2024-09-26 12:09  妖狐鬼魅  阅读(9)  评论(0编辑  收藏  举报