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.
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 CountOfClientIDFROM (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_codeGROUP BY dbo_state_lang_cds.slc_desc, dbo_FRWCClientInfo.LangORDER 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 sinner join FRWCServices ON FRWCClientInfo.ClientID = FRWCServices.ClientIDleft join sms.dbo.state_lang_cds l on s.lang = l.slc_codegroup by s.lang, l.slc_descWhat 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 |
|
|
|
|
|
|