我想从使用number of rows
的mysql查询中返回group by
。
表
CREATE TABLE IF NOT EXISTS TestRunSteps (
`idTestRunSteps` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`idUsersExecBy` VARCHAR(10) NULL ,
`LastExecUserIPV4` INT UNSIGNED NULL ,
PRIMARY KEY (`idTestRunSteps`);
SELECT count(*)
from proj1_db.TestRunSteps
group by idUsersExecBy,LastExecUserIPV4
返回
3,000002,3232236222
1,000003,3232236222
5,000004,3232236222
我想要的是一个简单的3
- 3行。请告诉我如何
答案 0 :(得分:1)
组数是按组分组的不同组合的数量。返回该数字的查询是:
select count(distinct idUsersExecBy, LastExecUserIPV4)
from proj1_db.TestRunSteps
答案 1 :(得分:0)
select count(*)
from
(SELECT count(*)
from proj1_db.TestRunSteps
group by idUsersExecBy,LastExecUserIPV4) as temp