• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 397
  • Last Modified:

Get the count from my select statement?

I need simply the COUNT of the following statement:

SELECT       t1.UserID, t1.State, t1.City, t2.Active
FROM          City AS t1 INNER JOIN
                      members AS t2 ON t1.UserID = t2.UserID
WHERE     (t1.State = 'New York') AND (t1.City = 'New York City') AND (t2.Active = 1)


How do I do this?
0
arthurh88
Asked:
arthurh88
1 Solution
 
informaniacCommented:
select @@Count
0
 
arthurh88Author Commented:
And how do I "select @@Count?"  

Please build my new statement for me.
0
 
Paul-BCommented:
SELECT COUNT(t1.UserID, t1.State, t1.City, t2.Active)
FROM          City AS t1 INNER JOIN
                      members AS t2 ON t1.UserID = t2.UserID
WHERE     (t1.State = 'New York') AND (t1.City = 'New York City') AND (t2.Active = 1)

Open in new window

0
 
micropc1Commented:
Count takes a single parameter. The correct statement is...

SELECT       Count (*)
FROM          City AS t1 INNER JOIN
                      members AS t2 ON t1.UserID = t2.UserID
WHERE     (t1.State = 'New York') AND (t1.City = 'New York City') AND (t2.Active = 1)

Open in new window

0
 
arthurh88Author Commented:
yes that worked perfectly
0

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now