Home > Backend Development > PHP Tutorial > php SQL判断字符串的步骤求解

php SQL判断字符串的步骤求解

WBOY
Release: 2016-06-13 10:34:24
Original
975 people have browsed it

php SQL判断字符串的方法求解

SQL code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$dsql->SetQuery("SELECT a.id,a.title,a.flag,b.aid,b.imgurl  FROM `#@__archives` a Join `#@__addonarticle` b On a.id = b.aid   where a.flag = 'f'  ORDER BY a.id DESC LIMIT 0,4");
Copy after login


以上 a.flag为字符串 在数据库中为 c,f,p,h,a

以上SQL查询flag为f没问题 请问怎么查询c,f或者c,f,p? 另外c,f,p能不能打乱了写?

------解决方案--------------------
............a.flag like '%c,f%'
------解决方案--------------------
SQL判断字符串 .a.flag like '%c,f%' 

------解决方案--------------------
str.a.flag like '%c,f%'就这样啊。很简单的
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template