0
首先,请对我感到高兴,我是一个初学SQL语言和英语的人。 所以我有这个问题。基于参数的mysql高级查询选择
我创建了sqlfiddle。 我的查询看起来像它的正常工作,但我觉得它是不工作
我想编写一个查询,返回基于参数的产品ID的变种,将发送
正确的查询结果会是什么样的以下
PARAM = 6
id product_id productvariant_id attributevalue_id
1 3 1 6
2 3 2 6
---- BAD RESULTS -----
3 3 3 6
4 3 3 9
6 3 5 6
7 3 6 6
8 3 6 11
PARAM = 6,9
id product_id productvariant_id attributevalue_id
3 3 3 6
4 3 3 9
---- BAD RESULTS -----
3 3 3 6
4 3 3 9
6 3 5 6
7 3 6 6
8 3 6 11
我真正需要的是回归productvariant_id含有插入则params的组合,如果我只发送一个attributevalue_id,我需要找到productvariant其中只包含一个attributevalue_id。如果我发送两个参数,我发现两个..的组合..不多或少