扫码关注官方订阅号
想问下像segmentfault,wordpress这样,文章列表,每条记录有标签,可以有多个。我不知道seg数据表是怎么设计的。说下WordPress的文章表,标签表:id,name,slug
文章与标签关系表:pid,tid
想问下这是怎么查询出来的?不要说循环。
能用SQL一次性查询出来吗?
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...
select id as pid from article where id in (select pid from tags_article where tid in (select tid from tags where name in (“标签”))) 很没效率
可以用全文索引,sphinx可以去研究下。反正搜索也是要用这个的。
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
select id as pid from article where id in (select pid from tags_article where tid in (select tid from tags where name in (“标签”)))
很没效率
可以用全文索引,sphinx可以去研究下。反正搜索也是要用这个的。