mysql -in 条件での変数の使用は変数に変更されます。

レンダリング

 コード

#定义变量
SET @beginTime='2022-03';
SET @endTime='2023-04';
SET @TYPES= "'1','2','3'";

SELECT * FROM test01 WHERE MONTH> @beginTime AND MONTH<@endTime and INSTR(@TYPES,type )>0;

SELECT * FROM test01 WHERE MONTH> @beginTime AND MONTH<@endTime and POSITION(type in @TYPES)> 0;

おすすめ

転載: blog.csdn.net/qq_43805205/article/details/130380833