语句如下:
$sql="select c.cid,c.cname,p.uid from `biz_channel` c,`pre_common_member_profile` p where p.resideprovince=c.cname and c.cmod='area' group by c.cid";where p.resideprovince=c.cname 这里的条件我想改成like 也就是where p.resideprovince like c.cname
但是查询到的和用等于是相同的结果,正常应该比用“等于”查询到的结果更多才对。我也尝试用where p.resideprovince like '%c.cname%' 和 where p.resideprovince like %c.cname% 都不行。请问正确的应该怎么写??
$sql="select c.cid,c.cname,p.uid from `biz_channel` c,`pre_common_member_profile` p where p.resideprovince=c.cname and c.cmod='area' group by c.cid";where p.resideprovince=c.cname 这里的条件我想改成like 也就是where p.resideprovince like c.cname
但是查询到的和用等于是相同的结果,正常应该比用“等于”查询到的结果更多才对。我也尝试用where p.resideprovince like '%c.cname%' 和 where p.resideprovince like %c.cname% 都不行。请问正确的应该怎么写??
解决方案 »
- 为什么我的PHP程序运行却突然显示源代码?
- 安装了apache只能在360浏览器上测试有用
- 正则表达式如何写?{ordinary|normal|regular|standard}
- require_once的问题
- PHP函数变量里面类似mysql_connect为什么不能赋给变量使用呢?
- 100分..急,....新手簡單問題....隨機網頁
- 为什么我的Smarty模板只接受 .tpl 而不接受 .html
- 急救!!小弟求一个在PHP中发布HTML格式新闻的控件
- 查询后如何返回记录的一部分?
- 为什么我的网站空间目录老是出现那么多垃圾文件
- 一个id可不可以传到多个网页?求解决
- php访问oracle问题...
数据是像的,c.cname这里存的是 河北、四川、湖南…………这样的数据
p.resideprovince 这里存的是 河北省、四川省、湖南省…………这样的,只能用like 查询
and where p.resideprovince like concat('%',c.cname,'%') ";