Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE FUNCTION udf_UserTotalCommits(@username VARCHAR(30))
- RETURNS INT AS
- BEGIN
- DECLARE @commits INT =
- (
- SELECT
- COUNT(*)
- FROM Commits c
- JOIN Users u ON c.ContributorId = u.Id
- GROUP BY u.Username
- HAVING u.Username = @username
- );
- RETURN @commits
- END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement