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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Getting a count

Author  Topic 

helixpoint
Constraint Violating Yak Guru

291 Posts

Posted - 2009-04-02 : 14:38:36
I am not sure you can give me an answer from just a query, but I have a script that brings back 265 records. How can I get a count from the query below

SELECT DISTINCT
g.ID AS memberID, ea.Address, g.FirstName, g.LastName, ea.htmlYes, '0' AS AccountType, '0' AS GroupID, ea.Golfer AS ID, c.ContactName, c.ContactEmail
FROM EmailAddresses AS ea INNER JOIN
Golfers AS g ON ea.Golfer = g.ID INNER JOIN
Sessions AS s ON s.Golfer = g.ID INNER JOIN
Courses AS c ON s.Course = c.ID INNER JOIN
CourseAllocation AS ca ON ca.Course = c.ID INNER JOIN
CourseOrganization AS co ON ca.CourseOrganization = co.ID
WHERE (c.Market = 6) AND (c.ID = 23) AND (co.ID = 10) AND (ea.IsOptedOut = 0)


Dave
Helixpoint Web Development
http://www.helixpoint.com

revdnrdy
Posting Yak Master

220 Posts

Posted - 2009-04-02 : 15:06:27
quote:
Originally posted by helixpoint

I am not sure you can give me an answer from just a query, but I have a script that brings back 265 records.



Well you are correct. We do not know what it is you are trying to get a count of.

You would need to be more specific. Are you trying to count all records or just a subset of them?

r&r
Go to Top of Page

helixpoint
Constraint Violating Yak Guru

291 Posts

Posted - 2009-04-02 : 15:08:47
I figured it out. thanx

Dave
Helixpoint Web Development
http://www.helixpoint.com
Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-04-02 : 15:08:57
in the same query as another column? but you can use @@ROWCOUNT

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page
   

- Advertisement -