开发者

How to match multiple field in mySQL

Im trying to match forum_id with several different forum_id's, something like forum_id = 5,7,12,43,63,78

I currently have this code:

SELECT topic_title, topic_id, forum_id 
FROM $MYSQL_TOPIC 
WHERE topic_title 
LIKE '%%%s开发者_C百科%%' 
    AND forum_id = 5 
LIMIT 50

(using mysql_real_escape_string and sprintf)

I tried:

forum_id = 5 OR 7
forum_id = 5|7
forum_id = 5 AND 7
forum_id = 5 & 7

But none of them will match them all and therefore search though them all.


forum_id IN (5,7,12,43,63,78)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜