我有一个正在运行的生成的SQL查询,但是我无法计算出它的数量!
GROUP BY功能会阻止正常的COUNT(*)工作。.希望有人可以提供帮助。

SELECT wposts.* FROM wp_posts wposts, wp_postmeta wpostmeta
WHERE wposts.ID = wpostmeta.post_id
AND wpostmeta.meta_key = 'phone'
AND wpostmeta.meta_value = '1542'
AND wposts.post_status = 'publish'
AND wposts.post_type = 'tips' || wposts.ID = wpostmeta.post_id
AND wpostmeta.meta_key = 'phone'
AND wpostmeta.meta_value = '1541'
AND wposts.post_status = 'publish'
AND wposts.post_type = 'tips' || ........
GROUP BY wposts.post_content
ORDER BY wposts.post_title ASC


谢谢

最佳答案

删除GROUP BY并将SELECT更改为仅COUNT(DISTINCT wposts.post_content)以获取此查询将返回的行数。

关于mysql - SQL查询帮助,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6991716/

10-12 06:06