Match fields between multiple tables in MySQL

Source: Internet
Author: User

"MySQL" Multi-table field matching 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 ['liance']; 6 $ dizhi = $ r ['dizhi']; 7} www.2cto.com: two tables info, tag info table id name 1 aa and bb 2 bb and cc 3 ee and dd www.2cto.com tag Table 1 aa 2 bb tag table name matches the name in info, so there is a problem: select info. id, info. name from tag, info where info. name like '%' + tag. name + '%' correct: select info. id, info. name from tag, info where info. name like concat ('%', tag. name, '%') origin: http://explife.cnblogs.com

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.