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 |
|
evanburen
Posting Yak Master
167 Posts |
Posted - 2009-11-03 : 16:15:58
|
| I don't understand why this code returns a count value for every user in the EDUsers table even when the count is zeroSELECT COUNT(dbo.Requests.ID) AS TotalOpenByEDUserFROM dbo.Requests RIGHT OUTER JOIN dbo.EDUsers ON dbo.Requests.UserID = dbo.EDUsers.UserIDWHERE dbo.Requests.DateClosed IS NULLGROUP BY dbo.EDUsers.Username, dbo.EDUsers.UserID, dbo.Requests.DateClosedORDER BY dbo.EDUsers.Usernamebut this one does not. It only gives me the count for every user where the count is > 0SELECT COUNT(dbo.Requests.ID) AS TotalClosedByEDUserFROM dbo.Requests RIGHT OUTER JOIN dbo.EDUsers ON dbo.Requests.UserID = dbo.EDUsers.UserIDWHERE dbo.Requests.DateClosed IS NOT NULLGROUP BY dbo.EDUsers.Username, dbo.EDUsers.UserID, dbo.Requests.DateClosedORDER BY dbo.EDUsers.Username |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
evanburen
Posting Yak Master
167 Posts |
Posted - 2009-11-03 : 18:46:45
|
| Is there any way to output a value of zero for the rest of the records in the second example? |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|