2011-07-15 51 views
1

如何返回string排除查询字符串它自己。mysql distinct select select排除它自我查询

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
select distinct replace(column, 'AAA/BBB/', '') as column 
from table 
where column like 'AAA/BBB/%'; 
+0

非常感谢。 – njai