instr函數(shù)在mysql中的用法
語法:
INSTR(str,substr)
注:
str:從哪個(gè)字符串中搜索
substr:要搜索的子字符串
sql語句如下:
# 將instr結(jié)果作為一列,并按其排序
select id,1 from world_guide where id = 32
union
select * from
(select id, instr('30,35,31,',id+',') as d from
world_blog where id in (30,35,31) order by d) as t;