1

I would like to get the number of rows returned from a mysql query that uses group by. table

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

returns

 3,000002,3232236222 
 1,000003,3232236222 
 5,000004,3232236222 

What I would like to have is a simple 3 - for 3 rows. Please tell me how

4

2 回答 2

1

组数是分组依据的列的不同组合的数量。返回该数字的查询是:

select count(distinct idUsersExecBy, LastExecUserIPV4)
from proj1_db.TestRunSteps
于 2013-11-11T13:47:54.440 回答
0
select count(*)
from
(SELECT count(*)
from proj1_db.TestRunSteps
group by idUsersExecBy,LastExecUserIPV4) as temp
于 2013-11-11T13:48:18.170 回答