Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Total count of records selected

Posted on 2014-07-16
3
Medium Priority
?
250 Views
Last Modified: 2014-07-16
Hi,

I need to find out the total count of records selected.

select IssueID
from SelectedDepartment 
where DepartmentImpactedID in (2,51) 
and (CreatedDate >= '01/17/2014' 
and CreatedDate <= '07/16/2014') 
Group by IssueID

the output that I have right now is this: 

IssueID
644
645
650
652
753

The output that I am looking for is this: 

TotalCountOfRecordFound
5

So, how am I going to change my query to get me this output?

Open in new window

0
Comment
Question by:lulu50
  • 2
3 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 2000 total points
ID: 40199772
select IssueID, count(*) over()
from SelectedDepartment
where DepartmentImpactedID in (2,51)
and (CreatedDate >= '01/17/2014'
and CreatedDate <= '07/16/2014')
Group by IssueID
0
 

Author Comment

by:lulu50
ID: 40199778
Great!!!!

Thank you sdstuber
0
 

Author Closing Comment

by:lulu50
ID: 40199780
Thank you
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ready to get certified? Check out some courses that help you prepare for third-party exams.
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question