Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Query Counting and Grouping with INNER JOIN

Status
Not open for further replies.

Page7

IS-IT--Management
Apr 13, 2010
14
0
0
IE
I have two tables one holds the names and information of different websites (sites) and another that holds requests (requests) from different websites I want to count the amount of requests for each website and have the query return the name of the websites and the amount of requests. Here is the link to an image of both tables.

I'm really having trouble with this I appreciate any help or even a link to an article. Thanks for any help in advance!

30xbbzo.jpg
 
I resolved this... Here is how I went about it in case anyone comes across this same type of issue in the future...

Thanks to anyone that was... thinking?... About helping out!

Code:
SELECT        sites.SiteName, COUNT(DISTINCT requests.ReqID) AS Requested
FROM            requests INNER JOIN
                         sites ON requests.SiteID = sites.SiteID
GROUP BY requests.SiteID, sites.SiteName
ORDER BY Requested DESC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top