我用手提的一部小篇的法典,试图在几小时左右总结我的脑。
I’m trying to create a query which retrieves some elements and in the end group them by a selector. I’ll try to demonstrate: I’m querying all the members in my organization. Each member is a member of a “department” and there can be several members in each department, but only one department for each member.
因此,我已提出由各部挑选我组织小组所有成员的问题。
当我用简单的<条码”展示时,我只想生产<条码>美元-和>;department_name/code>,但仅供该部使用一次。 现在,它说的是所有5个成员的“市场”,然后对所有这5名成员都修改了“人权”。 我曾尝试过一些不同的方法,例如阵列——unique,从而形成一种功能,即检查扼杀物,看看它是否相同,但却没有结果。
我可以设立两个论坛,但如果我完全不喜欢,因为两个论坛会影响业绩。
任何帮助或建议都会受到高度赞赏。
Sinerely
- Mestika
--- Edited --- By the way, my query looks like this:
SELECT *
FROM wp_term_taxonomy AS cat_term_taxonomy
INNER JOIN wp_terms AS cat_terms ON cat_term_taxonomy.term_id = cat_terms.term_id
INNER JOIN wp_term_relationships AS cat_term_relationships ON cat_term_taxonomy.term_taxonomy_id = cat_term_relationships.term_taxonomy_id
INNER JOIN wp_posts AS cat_posts ON cat_term_relationships.object_id = cat_posts.ID
INNER JOIN wp_postmeta AS meta ON cat_posts.ID = meta.post_id
WHERE cat_posts.post_status = publish
AND meta.meta_key = active
AND meta.meta_value = active
AND cat_posts.post_type = member
AND cat_term_taxonomy.taxonomy = deparment
GROUP BY cat_terms.slug, cat_term_relationships.object_id