程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> 『MySQL』多表之間字段的匹配

『MySQL』多表之間字段的匹配

編輯:MySQL綜合教程

『MySQL』多表之間字段的匹配   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 }   www.2cto.com   如下:兩個表info,tag   info 表   id name   1 aa和bb   2 bb和cc   3 ee和dd  www.2cto.com     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, '%')   來源:http://explife.cnblogs.com  

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved