0

如何在多列中搜索一个词:title, content. 例如:

$searchTerm = 'android';

SELECT * FROM posts WHERE `title` OR `content` contains $SearchTerm
4

3 回答 3

1
SELECT 
  *
FROM 
  posts
WHERE
  lower(`title`) LIKE '%android%'
  OR lower(`content`) LIKE '%android%'
于 2012-04-09T10:30:34.070 回答
0
SELECT *
FROM posts
WHERE
   `title` LIKE '%android%'
OR `content` LIKE '%android%'
于 2012-04-09T10:28:00.283 回答
0
$sql = "SELECT * FROM posts WHERE `title` LIKE '%$SearchTerm%' OR `content` LIKE '%$SearchTerm%'";
于 2012-04-09T10:28:18.280 回答