简体   繁体   English

多表连接搜索查询 PHP & Mysql

[英]Multiple Table Join For Search Query PHP & Mysql

I'm still facing problem with multiple table joining in MySQL.我仍然面临在 MySQL 中加入多个表的问题。 I want to make a search with multiple tables, here I have 8 tables & I want to join all tables together to get all values from 8 tables while searching my site.我想用多个表进行搜索,这里我有 8 个表,我想在搜索我的网站时将所有表连接在一起以从 8 个表中获取所有值。 Please help me to solve this problem.请帮我解决这个问题。 Thanks in advance.提前致谢。 [NB: All Table Formats Are Similar [注意:所有表格格式都相似

select *
from A
join B
on A.c1 = B.c2
join C 
on B.c3 = C.c4
join D
on C.c5 = D.c6
join E
on D.c7 = E.c8
join F
on E.c9 = F.c10
join G
on F.c11 = G.c12
join H
on G.c13 = H.c14

Replace large letters with your tables and ci with the corresponding column.用表格替换大字母,用相应的列替换 ci。 Join criteria can be virtually anything, for simplicity's sake I have chosen equality of columns加入条件几乎可以是任何东西,为了简单起见,我选择了列相等

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM