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 2000 Forums
 Transact-SQL (2000)
 SQL query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-06-16 : 08:45:31
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

30421 Posts

Posted - 2006-06-16 : 09:56:36
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
   

- Advertisement -