merge two rows and search in
I've used this MySQL query to get data:
SELECT DISTINCT A.*, B.username
FROM posts A, members B
WHERE B.status=1
AND (A.USERID=B.USERID AND A.title LIKE '%myquery%' AND B.public='1' AND A.type = 'update' )
order by A.ID desc limit 0, 10
this works to search title row, but i need to search into title and msg row, how to "merge" (?) these two rows into one and mak开发者_开发问答e my query?
this is my basic schema.
----------------------------
ID | title | msg ... |
----------------------------
1 | example | hello there | example data.
PS. sorry for my english.
if i understand your question
you can use the OR
... AND (A.title LIKE '%myquery%' OR A.msg LIKE '%myquery%') ...
精彩评论