sql查询来计算行数

时间:2017-05-16 08:19:57

标签: sql

我有一张这样的表

enter image description here

2 个答案:

答案 0 :(得分:0)

SELECT
    base.*, aaa.the_count
FROM
    TABLE base
INNER JOIN (
    SELECT
        GROUP,
        count(*) AS the_count
    FROM
        TABLE
    GROUP BY
        1
) aaa ON aaa. GROUP = base. GROUP

答案 1 :(得分:0)

这将返回表格中的记录数量:

select count(*) from tablename;