Tha*_*anu 33 mysql variables stored-procedures in-clause
假设我有一个SP,其SELECT
声明如下,
SELECT product_id, product_price FROM product
WHERE product_type IN ('AA','BB','CC');
Run Code Online (Sandbox Code Playgroud)
但是数据转到该IN
子句必须通过包含值字符串的单个变量.下面有东西链接
SELECT product_id, product_price FROM product
WHERE product_type IN (input_variables);
Run Code Online (Sandbox Code Playgroud)
但它没有那样工作.知道怎么做吗?
Dev*_*art 51
像这样传递参数值 - 'AA,BB,CC'
.然后,使用FIND_IN_SET函数就足够了-
SELECT product_id, product_price
FROM product
WHERE FIND_IN_SET(product_type, param);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
30438 次 |
最近记录: |