Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
405 views
in Technique[技术] by (71.8m points)

数据库中,寻找同时包含两个或多个标签的数据

比如这张图,列名为pxlx,想找到这列里同时包含(9,10)的数据,用mysql里的in的话,select * from table_p where pxlx in(9,10) 会仅显示数据为9的数据,找不到同时包含9,10的。大佬们,帮帮忙吧!
image.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

FIND_IN_SET(str,strlist)去找下这个函数的使用,不过效率不高

select * from table_p where find_in_set('9',pxlx)>0 and find_in_set('10',pxlx)>0;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...