2011-07-15 79 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