Hi i am create on store procedure for the UserFollowers. now i want to set the notification for the user followers.and in this notification when user gets 20 new followers for past 2 horus then send this type notification like 'abc, xyz and 18 other users followed you.' right now as par my logic in query just send one user is follow other user then send notification. so how can do that with this query any one know please let me know.
This is my query =>
DECLARE @FollowerId int,
DECLARE @UserId int
INSERT INTO UserFollowers
(
FollowerId,
UserId,
IsFollowed
)
VALUES
(
@FollowerId,
@UserId,
1
)
EXEC AddNotification @UserId, @FollowerId, 1, 'User Follow', null, null, null
SELECT @ActionUserName = UserName FROM Users WHERE UserId = @FollowerId
SELECT 'Followed'
SELECT REPLACE(ISNULL(NTL.NotificationText,NT.NotificationText), '##UserName##', @ActionUserName) AS NotificationText,
U.UserId,
U.UserName
FROM NotificationTexts NT
LEFT JOIN NotificationTextsByLanguage NTL ON NT.NotificationTextId = NTL.NotificationTextId
INNER JOIN Users U ON U.UserId = @UserId
INNER JOIN UserNotificationSetting UNS ON U.UserId = UNS.UserId
INNER JOIN NotificationTypes NTYPE ON NT.NotificationTypeId = NTYPE.NotificationTypeId
WHERE NT.NotificationTextId = 1 AND UNS.NotificationGroupTypeId = NTYPE.NotificationGroupTypeId
my current o/p is =>
abc followe you.
my expected o/p => abc, xyz and 18 other users followed you
any one how can do that with this query please let me know.