| Author |
Topic |
|
Frozilla
Starting Member
3 Posts |
Posted - 2012-09-17 : 16:53:26
|
| I have a query that returns the followingEmployee Name/EventStart/EventEnd etc.Matt/jan/decMatt/feb/decJoe/feb/decand I'd like to get a count for each unique employee name, for example Matt-2 Joe-1Is there any easy way to utilize the Count function to do a count of each unique employee name? I'm trying to build an internal report using SQL Report Builder 3.0 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-09-17 : 17:00:55
|
| [code]SELECT EmployeeName,COUNT(*) AS EmpCntFROM TableGROUP BY EmployeeName[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
Frozilla
Starting Member
3 Posts |
Posted - 2012-09-17 : 17:06:49
|
| Thanks for the response. I'm pretty new to all this SQL stuff so I'm learning as I go. Do I need to "set" my query result as a new table for this to work? The result of the query is based on parameters the user puts in such as manager name and date range. Therefore the query would only display employees under that manager that had a trip in the designated date range. Otherwise I tried doing some count stuff in SQL Server Management Studio and the count pops up easily, but in SQL Report Builder, I don't see anyway to pull in the count or where the count goes. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-09-17 : 17:14:24
|
first question is where do you want to show this result?for adding Manager date filters you can extend query toSELECT EmployeeName,COUNT(*) AS EmpCntFROM TableWHERE ManagerName = @YourManagerAND DateField >= @startDate AND DateField < @EndDate +1GROUP BY EmployeeName you define parameters for managername,date ranges and pass value through them------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
Frozilla
Starting Member
3 Posts |
Posted - 2012-09-17 : 17:22:41
|
I have all those parameters setup. I have a report right now that has the user (manager) choose their name and then a date range. They run the report and get a list of all their employees that were out of office during that time range, what they were doing, where and from when to when. I also want this report to display each employees name during that given time period and a count of their trips. I'm not sure if you're familiar with SQL Report Builder 3.0, but in SQL Server Management Studio if I insert a count function, the count displays on the screen. In SQL Report Builder 3.0, I get no syntax errors, but I don't see anyway to access the count and display it in my report. Thank you for your help! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-09-17 : 17:33:09
|
| I know Report BuilderReport builder just builds a reporting model. So when you add count, it adds as a measure inside Report Builderin order to use it somebody has to access report model using click once application from reporting server ,include the created report model and add the count measure you add for one of the reports they create------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|