Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

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

Ask SQLTeam Question

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:

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.


Patron Saint of Lost Yaks

30421 Posts

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

Try to post here

Peter Larsson
Helsingborg, Sweden
Go to Top of Page
  Previous Topic Topic Next 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.03 seconds. Powered By: Snitz Forums 2000