0

我有两张桌子。一个包含两个文本字段以及其他字段。另一个表包含一个 varchar 字段。我想使用 LIKE %keyword% 搜索这三个字段。当我只搜索文本字段或 varchar 字段时,它可以工作。当我尝试搜索所有三个时,仅搜索 varchar。这是sql

SELECT * 
        FROM modx_expertise e
        INNER JOIN modx_expertise_appraiser ea ON e.expertise_id = ea.expertise_id
        INNER JOIN modx_web_user_attributes ua ON ua.internalKey = ea.internalKey
        INNER JOIN modx_web_user_attributes_extended uae ON uae.internalKey = ua.internalkey
        WHERE uae.specialities
         OR uae.bio
         OR e.expertise
         LIKE  '%$keyword%'
         GROUP BY fname, lname";
4

2 回答 2

0
SELECT * 
        FROM modx_expertise e
        INNER JOIN modx_expertise_appraiser ea ON e.expertise_id = ea.expertise_id
        INNER JOIN modx_web_user_attributes ua ON ua.internalKey = ea.internalKey
        INNER JOIN modx_web_user_attributes_extended uae ON uae.internalKey = ua.internalkey
        WHERE uae.specialities
         LIKE  '%$keyword%'
         OR uae.bio
         LIKE  '%$keyword%'
         OR e.expertise
         LIKE  '%$keyword%'
         GROUP BY fname, lname";
于 2012-08-01T19:53:07.353 回答
0
...
WHERE uae.specialities LIKE  '%$keyword%'
OR uae.bio LIKE  '%$keyword%'
OR e.expertise LIKE  '%$keyword%'
...  
于 2012-08-01T19:53:44.587 回答