已知 数据表1 有字段名 规格
规格的数据格式为 φ124×12×278 或 φ124×12
需要查询出相同规格的数据
φ124×12×278 相同规格例如 φ124×278×12 φ12×278×124
φ12×124×278 φ278×124×12 φ278×12×124
select * from test where item = concat('φ', concat_ws('×','124','12','278')) union all select * from test where item = concat('φ', concat_ws('×','124','278','12')) union all select * from test where item = concat('φ', concat_ws('×','12','278','124')) union all select * from test where item = concat('φ', concat_ws('×','12','124','278')) union all select * from test where item = concat('φ', concat_ws('×','278','124','12')) union all select * from test where item = concat('φ', concat_ws('×','278','12','124'))
mysql 的语法,你参考一下
select * from test where item = concat('φ', concat_ws('×','124','12','278')) union all select * from test where item = concat('φ', concat_ws('×','124','278','12')) union all select * from test where item = concat('φ', concat_ws('×','12','278','124')) union all select * from test where item = concat('φ', concat_ws('×','12','124','278')) union all select * from test where item = concat('φ', concat_ws('×','278','124','12')) union all select * from test where item = concat('φ', concat_ws('×','278','12','124'))
mysql 的语法,你参考一下
select * from table where 规格 in (
selelect count(规格) from table
having count (规格) >1
—)