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 # of results from SELECT statement

Author  Topic 

ibskyde
Starting Member

4 Posts

Posted - 2008-06-06 : 11:15:56
Hey all - VERY new to SQL so I apologize if I butcher normally trivial things :)

Looking to run a query that will retrieve the number of results returned from a select statement...

Currently have a LicenseID table with a Software column...the statement that works on it's own that i've got is:

SELECT * FROM Software WHERE LicensesID = 2

Currently when I run that with the data so far I get 4 results returned to me...how can I add to that statement so that instead of displaying the results themselves, I just get the number 4 returned as a total number of results?

Thanks all!

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-06-06 : 11:18:17

SELECT count(*) as counting FROM Software WHERE LicensesID = 2

Madhivanan

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

ibskyde
Starting Member

4 Posts

Posted - 2008-06-06 : 11:23:25
That did the trick! thanks for the quick response!
Go to Top of Page
   

- Advertisement -