SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 SQL query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

AskSQLTeam
Ask SQLTeam Question

USA
0 Posts

Posted - 06/16/2006 :  08:45:31  Show Profile  Visit AskSQLTeam's Homepage  Reply with Quote
Sue writes "Hello, I have this Access SQL query and I would like to convert it to SQL Server query:

Access:
SELECT dbo_state_lang_cds.slc_desc, Count(dbo_FRWCServices.Service2) AS CountOfService2, Count(dbo_FRWCServices.ClientID) AS CountOfClientID
FROM (dbo_FRWCClientInfo INNER JOIN dbo_FRWCServices ON dbo_FRWCClientInfo.ClientID = dbo_FRWCServices.ClientID) INNER JOIN dbo_state_lang_cds ON dbo_FRWCClientInfo.Lang = dbo_state_lang_cds.slc_code
GROUP BY dbo_state_lang_cds.slc_desc, dbo_FRWCClientInfo.Lang
ORDER BY dbo_FRWCClientInfo.Lang;


This is the SQL query that I'm trying to update:

select s.lang, l.slc_desc, count(*) as 'SvcCount', count(distinct clientid) as 'clientCount',
cast(count(*)as float) / cast (count(distinct clientid) as float) as 'Avg # of Services Per client'
from frwcservices s
inner join FRWCServices ON FRWCClientInfo.ClientID = FRWCServices.ClientID
left join sms.dbo.state_lang_cds l on s.lang = l.slc_code
group by s.lang, l.slc_desc

What I am trying to do is in the SQL query, bring in the ClientID field from the FRWCClientInfo.

There are two language fields (one in the FRWCServices table and one in the FRWCClientInfo table) and I want to know the average services, etc, but instead of the FRWCServices table, I now want to add a join to the FRWCClient info table.

thanks,
Sue"

SwePeso
Patron Saint of Lost Yaks

Sweden
30265 Posts

Posted - 06/16/2006 :  09:56:36  Show Profile  Visit SwePeso's Homepage  Reply with Quote
Access query?

Try to post here http://www.sqlteam.com/forums/forum.asp?FORUM_ID=3


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000