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 |
Zath
Constraint Violating Yak Guru
298 Posts |
Posted - 2011-06-15 : 12:35:45
|
This sql works fine but I need to also know how many times in the sql the A.RequestBy appears or the count of each distinct entry and also list it....SELECT DISTINCT U.UserID, U.fname + ' ' + U.lname AS 'Requested By'FROM Entries AINNER JOIN UserInfo U ON U.UserID = A.RequestByWHERE A.requestdate BETWEEN '01/01/2011' AND '05/31/2011' Been trying to find a way but need some input.Thanks!Zath |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-06-15 : 13:36:57
|
SELECT U.UserID, max(U.fname + ' ' + U.lname) AS [Requested By], count(*)FROM Entries AINNER JOIN UserInfo U ON U.UserID = A.RequestByWHERE A.requestdate BETWEEN '01/01/2011' AND '05/31/2011'group by U.UserID==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|