mysql count group by_解决mysql group by和count同时使用的问题

例如这样一个表,我想统计email和passwords都不相同的记录的条数

CREATE TABLE IF NOT EXISTS `test_users` (

`email_id` int() unsigned NOT NULL auto_increment,

`email` char() NOT NULL,

`passwords` char() NOT NULL,

PRIMARY KEY (`email_id`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT= ;

INSERT INTO `test_users` (`email_id`, `email`, `passwords`) VALUES

(, ‘[email protected]', ‘1e48c4420b7073bc11916c6c1de226bb'),

(, ‘[email protected]', ‘5294cef9f1bf1858ce9d7fdb62240546′),

(, ‘[email protected]', ‘5294cef9f1bf1858ce9d7fdb62240546′),

(, ‘[email protected]', ”),

(, ‘[email protected]', ”);

通常我们的做法是这样:

SELECT COUNT(*) FROM test_users WHERE = GROUP BY email,passwords

这样的结果是什么呢?

COUNT(*)

你可能感兴趣的:(mysql,count,group,by)