【发布时间】:2011-04-01 19:45:24
【问题描述】:
我正在运行波纹管查询以从 3 个 mysql 表中获取,它工作正常,但它增加了内存使用量,有时需要 10 秒才能开始加载页面
INNER JOIN table_tags AS ntg ON (ns.tags = '' OR CONCAT(' ',COALESCE(ns.tags,' '),' ') LIKE CONCAT('% ',ntg.tid,' %'))
INNER JOIN table_topics AS nto ON (ns.associated = '' OR CONCAT(' ',COALESCE(ns.associated,'-'),' ') LIKE CONCAT('%',nto.topicid,'%' ))
问题在 Inner Join statemnet 中,如果我删除了
ns.tags = '' 或
和
ns.associated = '' 或
内存过度使用问题将得到修复,但无法显示带有空标签字段的故事
有没有其他方法可以写出下面的声明来包括所有故事,即使是那些没有标签的故事!?
INNER JOIN table_tags AS ntg ON (ns.tags = '' OR CONCAT(' ',COALESCE(ns.tags,' '),' ') LIKE CONCAT('% ',ntg.tid,' %'))
我的标签 id 存储在 table_ns 中,例如 (14 17 2),用空格分隔
【问题讨论】:
标签: php mysql concatenation inner-join