我创建了一个临时表,其中对应一个fileid
是主键,我有5行。我希望将计数设为5.为了得到与每个fileid
相对应的计数,我需要编写哪些查询?
答案 0 :(得分:1)
Select id, count(*) from #tmpTable
Group by id
答案 1 :(得分:0)
Select Count(Primary_Key_Field) as PrimaryFieldCount, Primary_Key
From TmpTbl
Group by Primary_Key
答案 2 :(得分:0)
SELECT
GroupByField,
COUNT(*)
FROM
#TableName
GROUP BY
GroupByField