Link to home
Start Free TrialLog in
Avatar of John Ellis
John Ellis

asked on

SQL: Counting the number of records

Hello:

I'm surprised that this is harder than I thought it would be.  All I want it for T-SQL to tell me the number of records, for a date range.  The following is my query:

select HRI..SOP30200.SOPNUMBE, HRI..SOP30200.DOCDATE
from HRI..SOP30200
where HRI..SOP30200.DOCDATE BETWEEN '2016-02-01' AND '2016-02-29' AND HRI..SOP30200.SOPTYPE = '3'

The query says "tell me the invoice number and its date, where the date range is 02/01/2016 through 02/29/2016.

I tried using select COUNT(), but all this did was give me over a thousand records with the number "1" in each record.

Wow!  I just want to know how many invoices are returned by this query--plain and simple.  How do I do that?

Thanks!

John
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial