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 2008 Forums
 Transact-SQL (2008)
 Count function

Author  Topic 

rico1931
Starting Member

37 Posts

Posted - 2009-06-05 : 11:48:45
Hello

I'm trying to get a count function to work with two different tables and having a bit of trouble. here is the table layout

BROWSER HOME table

FACT_KEY FACTKEY_BROWSER_TITLE
-------- --------
1 Home Page
2 About Us
3 Contact Us


That is the table with the Browser Title that I need Next is the table that I need to count

LOG_USER table

LOG_KEY LOG_BROWSER
----------- --------------------------------------------------
253 Contact us
254 Home Page
256 Contact us
257 Home Page
261 Home Page
263 Home Page
277 Home Page
279 Home Page
280 Home Page
281 Home Page
282 Home Page
283 Home Page
275 About Us
248 Contact Us
322 Contact us


The results should look like something like this

BROWSER COUNT
----------- --------------------------------------------------
HomePage 10
About Us 1
Contact us 4


So far this is what I have

SELECT count(LOG_BROWSER) as count
FROM dbo.LOG_USER
WHERE dbo.LOG_USER.LOG_BROWSER = 'Home Page'


but I need all of the BROWSER column and to do a count for all column as well

thanks in advance!

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2009-06-05 : 13:03:26
SELECT dbo.LOG_USER.LOG_BROWSER, count(LOG_BROWSER) as count
FROM dbo.LOG_USER
GROUP BY dbo.LOG_USER.LOG_BROWSER


Be One with the Optimizer
TG
Go to Top of Page

rico1931
Starting Member

37 Posts

Posted - 2009-06-05 : 13:03:28
Please disregard this post I found another post similar to my question thank you
Go to Top of Page

rico1931
Starting Member

37 Posts

Posted - 2009-06-05 : 13:03:44
thank you TG!
Go to Top of Page
   

- Advertisement -