MYSQL多表查询结果合并的办法
2011/09/07 15:27 ArthurXF
$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的结果集合并后,进行排序,可以轻松实现多表查询结果合并。
ArthurXF倾情奉献!
OR content LIKE ''%biweb%'' UNION SELECT * FROM biweb_user WHERE title LIKE
''%biweb%'' OR content LIKE ''%biweb%'' ORDER BY submit_date DESC";
使用UNION可以把多个select的结果集合并后,进行排序,可以轻松实现多表查询结果合并。
ArthurXF倾情奉献!