我试着用术语表加入我的发布表行,我的数据库发布和数据库结构与wordpress相同,我不知道如何将多行加入一行;如何使用条款查询一个帖子?
明显的例子:
交表:
post_id
post_title
post_content
post_dateline
post_owner
术语表:
term_id
term_name
term_title
term_type
term_relationships表:
post_id
term_id
现在我有: 一个id值为3的帖子; 三个学期用的ID值(4,6,7)
term_relationships像行:
post_id term_id
3 4
3 6
3 7
能够获得所有这些信息与一个查询,或者我应该先查询职位,然后尝试获取方面信息?
如果您需要返回单个行,那么还有mysql group_concat()函数,但您最好使用单独的查询来获取帖子/术语关系。 –
为什么你在表格中没有post_id列? – miro
我使用word_report这样的term_relationships,因为一个职位有多个条款 –