Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/250.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在多个表中搜索关键字以及在其他表中搜索关系 我有一些大桌子,公司的和联系人的 表:t_公司 id公司名称(全文) 1罗瓦酒店 2乔丹科尔酒店 3啊 4 Vries BV 表:t_联系人(全文) id全名 1约翰·德弗里斯 2罗瓦霍伯曼 3雅各布·肖恩 安娜·肖恩 //此表用于链接与公司的联系人。联系人可以链接到多个公司的 表:公司联系方式 id\u参考号\u公司id\u参考号\u联系人 1 1 2 2 2 1 3 2 4 4 3 1 5 4 2 我喜欢用关键字搜索t_company.company_name和t_contact.fullname 在t_company中找到时,请在company_contact.id_ref_contact中查找联系人 在t_contact中找到时,请在company_contact.id_ref_company中查找公司的 搜索示例:“de vries”匹配t_contact.id 1和t_company.id 4 在t_contact中找到,因此从公司获取id_ref_公司id 在t_公司中找到,因此从公司获取联系id_参考_联系id 结果应该是 3结果: t_contact.id t_contact.fullname t_company.id t_company.company_name 1约翰德弗里斯2乔丹科尔 1约翰·德弗里斯3 AH 2 anna schoon 4 Vries BV 是否可以在一个查询中执行此操作?_Php_Mysqli - Fatal编程技术网

Php 如何在多个表中搜索关键字以及在其他表中搜索关系 我有一些大桌子,公司的和联系人的 表:t_公司 id公司名称(全文) 1罗瓦酒店 2乔丹科尔酒店 3啊 4 Vries BV 表:t_联系人(全文) id全名 1约翰·德弗里斯 2罗瓦霍伯曼 3雅各布·肖恩 安娜·肖恩 //此表用于链接与公司的联系人。联系人可以链接到多个公司的 表:公司联系方式 id\u参考号\u公司id\u参考号\u联系人 1 1 2 2 2 1 3 2 4 4 3 1 5 4 2 我喜欢用关键字搜索t_company.company_name和t_contact.fullname 在t_company中找到时,请在company_contact.id_ref_contact中查找联系人 在t_contact中找到时,请在company_contact.id_ref_company中查找公司的 搜索示例:“de vries”匹配t_contact.id 1和t_company.id 4 在t_contact中找到,因此从公司获取id_ref_公司id 在t_公司中找到,因此从公司获取联系id_参考_联系id 结果应该是 3结果: t_contact.id t_contact.fullname t_company.id t_company.company_name 1约翰德弗里斯2乔丹科尔 1约翰·德弗里斯3 AH 2 anna schoon 4 Vries BV 是否可以在一个查询中执行此操作?

Php 如何在多个表中搜索关键字以及在其他表中搜索关系 我有一些大桌子,公司的和联系人的 表:t_公司 id公司名称(全文) 1罗瓦酒店 2乔丹科尔酒店 3啊 4 Vries BV 表:t_联系人(全文) id全名 1约翰·德弗里斯 2罗瓦霍伯曼 3雅各布·肖恩 安娜·肖恩 //此表用于链接与公司的联系人。联系人可以链接到多个公司的 表:公司联系方式 id\u参考号\u公司id\u参考号\u联系人 1 1 2 2 2 1 3 2 4 4 3 1 5 4 2 我喜欢用关键字搜索t_company.company_name和t_contact.fullname 在t_company中找到时,请在company_contact.id_ref_contact中查找联系人 在t_contact中找到时,请在company_contact.id_ref_company中查找公司的 搜索示例:“de vries”匹配t_contact.id 1和t_company.id 4 在t_contact中找到,因此从公司获取id_ref_公司id 在t_公司中找到,因此从公司获取联系id_参考_联系id 结果应该是 3结果: t_contact.id t_contact.fullname t_company.id t_company.company_name 1约翰德弗里斯2乔丹科尔 1约翰·德弗里斯3 AH 2 anna schoon 4 Vries BV 是否可以在一个查询中执行此操作?,php,mysqli,Php,Mysqli,我想我找到了正确的解决方案,在ANKIT的帮助下 Select c.id, c.fullname, a.id, a.company_name from t_company a join company_contact b on a.id = b.id_ref_company join t_contact c on c.id = b.id_ref_contact where c.fullname like '%de vries%'; 我投票结束这个问题,因为这是对免费代码的公然要求。谢谢你的回复

我想我找到了正确的解决方案,在ANKIT的帮助下

Select c.id, c.fullname, a.id, a.company_name
from t_company a
join company_contact b on a.id = b.id_ref_company
join t_contact c on c.id = b.id_ref_contact
where c.fullname like '%de vries%';

我投票结束这个问题,因为这是对免费代码的公然要求。谢谢你的回复,它帮助了我。我已经用关键字搜索和额外的WHERE完成了这个查询。
Select c.id, c.fullname, a.id, a.company_name
from t_company a
join company_contact b on a.id = b.id_ref_company
join t_contact c on c.id = b.id_ref_contact
where c.fullname like '%de vries%';
Select c.id, c.fullname, a.id, a.company_name 
from t_company a 
join company_contact b on a.id = b.id_ref_company 
join t_contactpersoonpersoon c on c.id = b.id_ref_contact 
WHERE MATCH(c.fullname) AGAINST ('de* +vries*' IN BOOLEAN MODE) or 
MATCH(a.company_name) AGAINST ('de* +vries*' IN BOOLEAN MODE)