sql 使用變數帶入in條件

妖狐鬼魅發表於2024-09-26
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)

相關文章