Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 count action

Author  Topic 

Leo_Don
Starting Member

42 Posts

Posted - 2011-02-02 : 06:08:35
Hi experts,

need a help

have a table with
id | action| date|
-------------------
1| call| 02-01-11
1| call| 03-01-11
1| mail| 02-01-11
2| call| 03-01-11
2| mail| 02-01-11

i am trying to generate a report where in i can count the action for the user on date
below is the query what i am trying

select id, action, action, count(action) as sum, date
from table group by action, userid

but i need to group by date as well which i dont want to as i can select the date in the report...

any help
thanks in advance

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-02-02 : 06:28:01
post the required output format for the given data ..so that we can map your requirements on the given input :D
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-02-02 : 08:55:29
Pass a value to datetime parameter

select id, action, action, count(action) as sum
from table group by action, userid
WHERE datecol=@date_value

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -