i used CONCAT to get my tags and topics but if the story has no tag or topic then result is empty
WHERE
CONCAT( ' ', table_stories.ta开发者_开发问答gs, ' ' )
LIKE CONCAT( '%', table_tags.tid, '%' )
AND
CONCAT( ' ', table_stories.associated, ' ' )
LIKE CONCAT( '%', table_topics.topicid, '%' )
as you see , everything fine unless we have story that has no tag or associated
i used
table_stories.tags IS NULL OR
but problem still exists and cant fetch stories with no tag or associated
how can i fix this
I don't have mysql handy to test but COALESCE()
is probably the function you are looking for.
This returns the first non-null argument (See Documentation)
So
CONCAT(' ' , COALESCE(table_stories.associated, ' '), ' ')
should do the job
精彩评论