当前位置: > 教程 > 服务器 >

MYSQL多表查询结果合并的办法
栏目分类:服务器   发布日期:2020-05-29   浏览次数:

$query_rs .= "SELECT * FROM biweb_news WHERE title LIKE ''%biweb%'' OR content LIKE ''%biweb%'' UNION SELECT * FROM biweb_user WHERE title LIKE ''%biweb%'' OR content LIKE ''%biweb%'' ORDER BY submit_date DESC"; 使用UNION可以把多个select的

$query_rs .= "SELECT * FROM biweb_news WHERE title LIKE ''%biweb%''

OR content LIKE ''%biweb%'' UNION SELECT * FROM biweb_user WHERE title LIKE

''%biweb%'' OR content LIKE ''%biweb%'' ORDER BY submit_date DESC";

使用UNION可以把多个select的结果集合并后,进行排序,可以轻松实现多表查询结果合并。

相关热词:

js特效 教程 资源 资讯