mysql distinct select选择排除它自我查询

时间:2011-07-15 00:17:51

标签: mysql

如何返回字符串排除查询字符串。

column string =   AAA/BBB/CCC
result string =   BBB/CCC where column like AAA



column string =   AAA/BBB/CCC
result string =   CCC where column like AAA/BBB


"SELECT DISTINCT `column` FROM `table` WHERE `column` like '???'";

谢谢。

1 个答案:

答案 0 :(得分:1)

select distinct replace(column, 'AAA/BBB/', '') as column
from table 
where column like 'AAA/BBB/%';