Skip to content Skip to sidebar Skip to footer

How Do You Count The Number Of Rows In A Table That Have The Same Value In Value In A Column?

Suppose I have the following simple table: create table mytable ( desid bigint not null, ancid bigint not null ); insert into mytable (ancid,desid) values (1,10); insert

Solution 1:

You can get the information by grouping by the ancid:

SELECT   ancid, COUNT(*)
FROM     mytable
GROUP BY ancid

Post a Comment for "How Do You Count The Number Of Rows In A Table That Have The Same Value In Value In A Column?"