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 158627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:42:54+00:00 2026-05-11T10:42:54+00:00

I have the following tables (and example values): **user:** user_id (1, 2, 3) username

  • 0

I have the following tables (and example values):

**user:** user_id (1, 2, 3) username (john33, reddiamond...) password (pass1, pass2...)  **session:** session_id (4,5, 6) user_id (1, 2, 3)  **activity** activity_id (1, 2) name (running, walking...)  **user_activity** user_activity_id (1, 2, 3, 4, 5) session_id (4, 5) activity_id (1, 2) 

All columns with the same name are related. In the table user_activity there are rows which describe what is the session’s activity and the activity refers to users.

However I would like to get the table which describes what the user is currently doing:

**result** username(john33) activity.name(walking) 

What is the SQL statement that gets the result table?

(I’m using MSSQL).

  • 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. 2026-05-11T10:42:55+00:00Added an answer on May 11, 2026 at 10:42 am
    SELECT u.username, a.name FROM user_activity ua INNER JOIN session s ON ua.session_id = s.session_id INNER JOIN user u ON s.user_id = u.user_id INNER JOIN activity a ON ua.activity_id = a.activity_id 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say for example, I have the following two tables: TableA { _id } TableB
I have the following tables in my database that have a many-to-many relationship, which
I have the following tables in MySQL: team: id, name, [more stuff] person: id,
I have the following five tables: ISP Product Connection AddOn AddOn/Product (pivot table for
I have following situation. A main table and many other tables linked together with
I have the following code: ListBox.DataSource = DataSet.Tables(table_name).Select(some_criteria = match) ListBox.DisplayMember = name The
I have two tables with the following columns: table1: id, agent_name, ticket_id, category, date_logged
I have 2 tables with the following structure.. category { sub_cat_id - numeric sub_cat_name
I have a mysql table with the following columns: group_id game_id user_id message last_update
I have following table structure: Table: Plant PlantID: Primary Key PlantName: String Table: Party

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.