『MySQL』多表之间字段的匹配
来源:互联网 发布:数据标签外在哪里设置 编辑:程序博客网 时间:2024/06/08 12:39
1 $sql=$empire->query("select table.title,lianxi,table.dizhi,table.id from table,table1 where table1.sid like concat( '%|',table.id,'|%') and table1.id=".$navinfor[id]."");2 while($r=$empire->fetch($sql))3 {4 $title=$r['title'];5 $lianxi=$r['lianxi'];6 $dizhi=$r['dizhi'];7 }
如下:两个表info,tag
info 表
id name
1 aa和bb
2 bb和cc
3 ee和dd
tag表
1 aa
2 bb
tag表中 name 匹配 info 中的name
这样写就有问题: select info.id, info.name from tag,info where info.name like ‘%'+tag.name+'%'
正确:
select info.id, info.name from tag,info where info.name like concat( '%',tag.name, '%')
<script type="text/javascript"><!--google_ad_client = "ca-pub-1944176156128447";/* cnblogs 首页横幅 */google_ad_slot = "5419468456";google_ad_width = 728;google_ad_height = 90;//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- 『MySQL』多表之间字段的匹配
- 『MySQL』多表之间字段的匹配
- mysql多个数据表进行字段匹配
- 匹配表中所有字段的方法
- MYSQL不同字段之间四则运算
- hibernate与mysql之间的字段映射关系
- 查询sql中常用到 like 进行字段和字符之间的匹配
- 两个表之间多字段的匹配!
- 多表联查,两表之间相互关联,不一定需要有主外键关系,字段匹配就行
- MySQL修改表的字段
- 关于SqlServer多表根据字段值模糊匹配来连接查询的解决方法
- mysql find_in_set方法在一个字段里匹配用','号分割的各个值(记录)
- mysql查询逗号分隔字段匹配的值,可且可或
- Mysql精确查询时匹配到字段末尾有空格的值
- MYSQL 全表按照Key字段更新指定的字段
- mysql的从另外一张表update多个字段
- mysql 一次更新单个表的多个字段
- 数据库表中字段之间的关系设置
- php将ip转换成无符号整数
- ssh: connect to host localhost port 22: Connection refused 问题
- JQuery选择器使用以及对元素的操作方法
- 51中ret和reti的区别
- 2013年5月华为实习生招聘之机试练习题
- 『MySQL』多表之间字段的匹配
- UVa 10453 - Make Palindrome 字符串dp
- 应用jBPM4解决中国特色的流程需求
- eclipse建立Flex项目之Blazeds篇1(测试成功完整版)
- Creating Dynamic Web Project using Maven in Eclipse
- 微内核流程引擎(IVR导航)的设计与实现(一)——开发背景
- poj1218——THE DRUNK JAILER
- 第17章 容器深入研究
- NSInvalidUnarchiveOperationException