views:

61

answers:

3

Hi guys,

I have created one temporary table in which corresponding to one fileid which is primary key, I am having 5 rows. I want to get the count as 5. What query do I have to write to get the count corresponding to each fileid?

+1  A: 
Select id, count(*) from #tmpTable
Group by id
Binary Worrier
A: 
Select Count(Primary_Key_Field) as PrimaryFieldCount, Primary_Key
From TmpTbl
Group by Primary_Key
u07ch
A: 
SELECT
     GroupByField,
     COUNT(*)
FROM 
     #TableName
GROUP BY
    GroupByField
Gavin Draper