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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:24:22+00:00 2026-05-29T09:24:22+00:00

I have the next 2 tables: Users +—-+———–+ | id | user_name | +—-+———–+

  • 0

I have the next 2 tables:

     Users
+----+-----------+
| id | user_name |
+----+-----------+
| 18 | Andrei    |
| 19 | Gicu      |
| 20 | Gigel     |
+----+-----------+
         Requests
+----+-----------+---------+
| id | from_user | to_user |
+----+-----------+---------+
|  3 |        18 |      19 |
|  4 |        18 |      20 |
|  5 |        20 |      19 |
+----+-----------+---------+

And i make the following query:

SELECT requests.from_user 
 FROM requests 
  WHERE 
   (SELECT id FROM users WHERE users.user_name='Gicu')=requests.to_user;

which returns:

+-----------+
| from_user |
+-----------+
|        18 |
|        20 |
+-----------+

My question now is … how to get the user names associated to these ids (18 and 20) What should i add to the query? (I’m not familiar to joins/union and those other stuff)

  • 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-29T09:24:23+00:00Added an answer on May 29, 2026 at 9:24 am
    SELECT users.user_name
    FROM users
    WHERE users.id IN 
            (SELECT requests.from_user 
             FROM requests 
             WHERE 
                  (SELECT id 
                   FROM users 
                   WHERE users.user_name='Gicu')
             =requests.to_user 
            )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the next tables Users {id, name} Messages {id, user_id, cache_user_name} What I
I have next tables Order , Transaction , Payment . Class Order has some
I have the following function. $(function() { $(.sectionHeader:gt(0)).click(function() { $(this).next(.fieldset).slideToggle(fast); }); $(img[alt='minimize']).click(function(e) { $(this).closest(table).next(.fieldset).slideUp(fast);
I have three tables: Users Questions User_Questions 1.user questions has the columns user_id, question_id,
I have three tables, that are like: users --------------- id etc... badges --------------- id
I have two tables, users{name,id,age_range_id} and age_ranges{id,range_name} . There are also two models, controllers
I have two tables, one containing a list of different options users can select
Let's say I have two SQL tables: QYZ: id, uid<user id, FK*>, somedatacolumn USERS:
Suposse I have the next MySQL database with 500.000 rows : users { id
I have a table story_category in my database with corrupt entries. The next query

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.