Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6865581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:04:19+00:00 2026-05-27T03:04:19+00:00

So I am trying to develop an activity feed for my site, Basically If

  • 0

So I am trying to develop an activity feed for my site,

Basically If I UNION a bunch of activities into a feed I would end up with something like the following.

Chris is now friends with Mark

Chris is now friends with Dave

What I want though is a neater way of grouping these similar posts so the feed doesn’t give information overload…

E.g.

Chris is now friends with Mark, Dave and 4 Others

Any ideas on how I can approach this logically?

I am using Classic ASP on SQL server.

Here is the UNION statement I have so far…

SELECT      U.UserID As UserID, L.UN As UN,Left(U.UID,13) As ProfilePic,U.Fname + ' ' + U.Sname As FullName, 'said ' + WP.Post AS Activity, WP.Ctime
FROM         Users AS U LEFT JOIN Logins L ON L.userID = U.UserID LEFT OUTER JOIN
                      WallPosts AS WP ON WP.userID = U.userID WHERE WP.Ctime IS NOT NULL
UNION
SELECT     U.UserID As UserID, L.UN As UN,Left(U.UID,13) As ProfilePic,U.Fname + ' ' + U.Sname As FullName, 'commented ' + C.Comment AS Activity, C.Ctime
FROM         Users AS U LEFT JOIN Logins L ON L.userID = U.UserID LEFT OUTER JOIN
                      Comments AS C ON C.UserID = U.userID WHERE C.Ctime IS NOT NULL
UNION
SELECT     U.UserID As UserID, L.UN As UN,Left(U.UID,13) As ProfilePic, U.Fname + ' ' + U.Sname As FullName, 'connected with <a href="/profile.asp?un='+(SELECT Logins.un FROM Logins WHERE Logins.userID = Cn.ToUserID)+'">' + (SELECT Users.Fname + ' ' + Users.Sname FROM Users WHERE userID = Cn.ToUserID) + '</a>' AS Activity, Cn.Ctime
FROM         Users AS U LEFT JOIN Logins L ON L.userID = U.UserID LEFT OUTER JOIN
                      Connections AS Cn ON Cn.UserID = U.userID WHERE CN.Ctime IS NOT NULL
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:04:20+00:00Added an answer on May 27, 2026 at 3:04 am

    Just a general bit of advice: you should not be using display side logic in your SQL queries. For example you are writing <a> tags and HTML inside of your SQL code which I think is widely frowned upon. Additionally I think that the solution to your problem should be in the scripting end, not in a SQL query.

    As for your particular example, I think if you ordered by U.UserID then you would retrieve your data in a form where it will always have the “Chris is friends with …” items grouped together. From there I would work on my loop logic in ASP, so that instead of just looping through the recordset and outputting it, I would check each entry, and see if the userID from this activity matches the previous userID and then just join them. So for instance you could try the below (untested) code:

    oldID = 0
    activityCount = 0
    activityStream = ""
    Do While Not rs.eof
        If oldID <> rs("ID") Then
            Response.Write(activityStream)
            activityStream = rs("FullName") & " is friends with " & rs("ToUserID")
        Else
            activityCount = activityCount + 1
            If activityCount <= 3 Then
                activityStream = activityStream & ", " & rs("ToUserID")
            Else
                activityStream = activityStream & " and <a href='#'>" & activityCount & "others</a>"
                activityCount = 0
            End If
        End If
        oldID = rs("ID")
    rs.Movenext
    Loop
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to develop a custom activity for my sharepoint workflow that would
I am trying to develop a custom widget for camera preview. I would like
Im trying to develop my first ASP.NET MVC web app and have run into
I am trying to develop a multimedia site and I am leaning heavily toward
I'm trying to develop a firefox extension that inserts additional HTTP header fields into
I am trying to develop an app where it locks down the Activity and
I'm trying develop a reddit style site which allows users to vote on links.
I am trying develop a basic referrer system to my Django website, system will
I am trying to develop a .NET Web Project using NHibernate and Spring.NET, but
I am trying to develop everything in sharepoint as features so I can easily

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.