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

  • SEARCH
  • Home
  • 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 9035343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:44:14+00:00 2026-06-16T08:44:14+00:00

I have Tables Like 1) User Which Holds The Master Data Like User ID

  • 0

I have Tables Like

1) User Which Holds The Master Data Like

User ID   Name    OtherColumns
1         Banshi   Nothing
2         Banshi2  Nothing 
3         Banshi3  Nothing 

2)Second Table “Friends” Holds Data Like

ID    UserID     FriendID    FriendCategory
1       1          2             2
2       2          1             2
3       4          1             2
4       1          4             2

3)Third Table “Subscribers” Holds Data Like

ID    SubscribersID  SubscribToID    FriendCategory
1       1              3                  3
2       1              4                  3

4)Fourth Table “FriendCategory” Like

ID      Name
2       Friends
3       Subscribers

5)Fifth Table “Posts” Contains Data Like

PostID   UserID  Post           
1         2      Hello Dear Post By Banshi2
2         3      Hello Dear  Post By Banshi3
3         4     Hello Dear  Post By Banshi4 

Now Being User 1 i Need Data Like
A) I need Data if Posted By My Friends
B) I need Data if Posted By i am Subscribed to
c) If User is My Friend Subscribed as Well Then it Must Show Friend not i am Subscribed

My Data Something Like


UserID      Name        Post                          Category
2          Banshi2    Hello Dear Post By Banshi2     Friends
3          Banshi3    Hello Dear Post By Banshi3     I Am Subcriber 
4          Banshi4    Hello Dear Post By Banshi4     Friends

Please Suugest Me How to Get Such a Out put in Sql Server 2008

Thanks in Advance
Banshi

  • 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-06-16T08:44:15+00:00Added an answer on June 16, 2026 at 8:44 am

    For getting data if posted by friends

    SELECT
      u.UserID, u.Name , p.Post , fc.Name 
    FROM
      users as u,
      FriendCategory as fc,
      Subscribers as s,
      Friends as f,
      Posts as p 
    WHERE
      f.UserID=1
      and fc.id=f.FriendCategory
      and p.UserID = f.FriendID
    group by fc.Name
    

    You can do it similarly for getting data to i am subscribedto .

    c) If User is My Friend Subscribed as Well Then it Must Show Friend
    not i am Subscribed

    Well, i didn’t get what you were trying to say here .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables. The first table holds simple user data and has the
I have a couple of tables which look like this Table 1 user_id |
I have a table which stores test results like this: user | score |
I have two tables user and log. I would like to join the user
Hello I have like this 2 tables class User public int UserId{get;set;} { ....
I have a database which holds information about user-created items. Each item can have
I have a table which holds the guid for an user and their actual
I have a database table which holds meta data about images, the field in
I have two tables like of this structure: content (content_id, content_type, user_id, time, comment_count)
I have two MySQL tables something like this: tool_owners: tool_owners_id | user_id | ...

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.