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

My Schema I have the following tables table notes/example values ------------------------------------------------ users ( id
I have the following query in VBA: DoCmd.RunSQL INSERT INTO table (value) VALUES ('example')
Say for example, I have the following two tables: TableA { _id } TableB
For example, let's say I have the following two tables: Table1: Id ---- 1
I have following tables questions -> id, question_data, user_id users -> id, fname, lname
Let's say I have the following 4 tables (for examples' sake): Owners, Trucks, Boxes,
I have the following example in a SQL table Cust Group Sales A 1
Ok, I have an example table with the following information and query. First up
For example: In my table I have text field with following text: The quick
Suppose that we have following tables create table Employee( 2 EMPNO NUMBER(3), 3 ENAME

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.