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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:11:16+00:00 2026-05-21T20:11:16+00:00

I have a payments table that has the following structure. **Payments** id name created_by

  • 0

I have a payments table that has the following structure.

**Payments**
id
name
created_by - user_id
closed_by - user_id

**Users**
user_id
name
surname

What is the best way to show both the name and surname of the user who has created and closed the payment file.

The only way i can think this could work would be using a subquery for both(created_by,closed_by fields) thanks

  • 1 1 Answer
  • 1 View
  • 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-21T20:11:17+00:00Added an answer on May 21, 2026 at 8:11 pm

    Try this:

    SELECT p.id, p.name, 
    CONCAT (u1.name,' ', u1.surname) created,
    CONCAT (u2.name,' ', u2.surname) closed,
    FROM payments p INNER JOIN users u1
    ON p.created_by = u1.user_id
    INNER JOIN users u2
    ON p.closed_by = u2.user_id
    

    EDITED: if you want name and surname splitted

    SELECT p.id, p.name, 
    u1.name created_name, u1.surname created_surname,
    u2.name closed_name, u2.surname closed_surname,
    FROM payments p INNER JOIN users u1
    ON p.created_by = u1.user_id
    INNER JOIN users u2
    ON p.closed_by = u2.user_id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a payments table that has a user_id and an amount. Users have
I have a table that has multiple payments occuring on different dates each month.
I'm using SQL-Server 2005. I have two tables Users and Payments which has a
I have a MySQL table like this: Payments +----+---------------------+---------+ | id | date (sorted
I have a formula that distribute reptitions (payments) into columns that represents months. I
My website has premium videos, for which users have to pay to watch it.
I have the following tables: Services ID| Service_type_id| desc| date|payment_terms Service_types ID|NAME|isCredit Payment_Terms ID|Payment_Term
I have an application that allows users to create loads and bid on them.
I have a question about best practices related to de-normalization or table hierarchy relationships.
I have been working on a website that has to do with a subscription

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.