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 |
|
joblenis
Starting Member
29 Posts |
Posted - 2007-04-10 : 11:38:13
|
| I am trying to do a group by and left join together but it does not seem to be working.SELECT sb.[BrowserID] ,sum([BrowserTotal]) ,[BrowserName] FROM [IISLOG_REPORTS].[statistics].[browser] sbleft join [IISLOG_REPORTS].[lookups].[browser] lb on sb.browserid=lb.browseridGROUP BY sb.[BrowserID]ORDER BY sb.[BrowserID]The above code works without the blue line there (which is being fetched from the lb table). Any suggestions for this? I would need all 3, including the BrowserName. Thanks |
|
|
graz
Chief SQLTeam Crack Dealer
4149 Posts |
Posted - 2007-04-10 : 11:43:59
|
| TrySELECT sb.[BrowserID],[BrowserName],sum([BrowserTotal])FROM [IISLOG_REPORTS].[statistics].[browser] sbleft join [IISLOG_REPORTS].[lookups].[browser] lb on sb.browserid=lb.browseridGROUP BY sb.[BrowserID],[BrowserName]ORDER BY sb.[BrowserID]Every field that isn't an aggregate needs to be in the group by clause.===============================================Creating tomorrow's legacy systems today.One crisis at a time. |
 |
|
|
joblenis
Starting Member
29 Posts |
Posted - 2007-04-10 : 11:51:02
|
| Thanks that works great. I'll keep that in mind next time. |
 |
|
|
|
|
|