我对这个查询很感兴趣。我需要在具有不同结构的不同表中搜索一个单词。我只有一个搜索框,我正在做这三个查询以在不同的地方查找结果。我怎样才能在一个查询中完成所有这些以过滤在一起????
1)在此查询(来自 PHP)中,我使用表“programas_videos”的内连接在表“视频”、名称和表“程序”的描述中搜索单词“$palabra_buscar”
SELECT * FROM videos
INNER JOIN programas_videos ON videos.id_video = programas_videos.id_video
INNER JOIN programas ON programas_videos.id_prog = programas.id_prog
WHERE programas.nombre_prog LIKE "%'.$palabra_buscar.'%"
OR programas.descrip_larga LIKE "%'.$palabra_buscar.'%"
OR videos.descrip_larga LIKE "%'.$palabra_buscar.'%"
GROUP BY videos.id_video DESC LIMIT 10
2)我有另一个查询是在另一个表中搜索一个单词
SELECT * FROM videos
INNER JOIN contenidos1 ON videos.metadata = contenidos1.id_metadata
WHERE contenidos1.Title LIKE "%'.$palabra_buscar.'%"
OR contenidos1.Summary_Short LIKE "%'.$palabra_buscar.'%"
OR contenidos1.Summary_Long LIKE "%'.$palabra_buscar.'%"
OR contenidos1.Genre LIKE "%'.$palabra_buscar.'%" LIMIT 10
3)和这个查询
SELECT * FROM tableOfContents
WHERE tableOfContents .titulo LIKE "%'.$palabra_buscar.'%"
OR tableOfContents.descripcion LIKE "%'.$palabra_buscar.'%"
OR tableOfContents.categoria LIKE "%'.$palabra_buscar.'%"
GROUP BY tableOfContents.titulo LIMIT 10