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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:57:29+00:00 2026-05-15T05:57:29+00:00

I have a mysql table jobs . This is the basic structure of jobs

  • 0

I have a mysql table jobs.

This is the basic structure of jobs.

id
booked_user_id
assigned_user_id

I then also have another table, meta.

Meta has the structure:

id
user_id
first_name
last_name

Here is my php code

$sQuery = "
        SELECT SQL_CALC_FOUND_ROWS job_id, job_name, priority_id, meta.first_name, date_booked
        FROM jobs
        LEFT JOIN (meta) on (meta.user_id = jobs.booked_user_id)
        LEFT JOIN (jobs_priorities) on (jobs_priorities.id = jobs.priority_id)
        $sWhere
        $sOrder
        $sLimit
    ";
    $rResult = mysql_query($sQuery);

    while ( $aRow = mysql_fetch_assoc( $rResult ) )
    {
        $sOutput .= '"'.addslashes($aRow['job_id']).'",';
    }

How can I join these tables so that both booked_user_id and assigned_user_id can access meta.first_name?

When I try

$sOutput .= '"'.addslashes($aRow['first_name']).'", 

nothing happens

Thanks for your advice

Tim

  • 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-15T05:57:30+00:00Added an answer on May 15, 2026 at 5:57 am

    You can join twice:

    SELECT j.id, b.first_name, a.first_name
    FROM jobs j
    JOIN meta b ON j.booked_user_id = b.user_id
    JOIN meta a ON j.assigned_user_id = a.user_id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have MySQL InnoDB table utf-8 encoded. This table has only id and name
I have mysql table that has a column that stores xml as a string.
I have a MySQL table that looks something like this: +-----+------------+ | id |
I have a MySQL table called accounts . Within this table is a field
I have a mysql table structure like that: id int primary key name varchar
I have mysql table with data like this. record will have server with total
I have mysql set up like this MySQL Table: gallery +-------------+------------+ | galleryname |
I have recently switched jobs and at this new company we are using MySQL.
I have MySQL table with structure: | uid | itemid | ------------------- | 1001
I have MySQL table that doesn't have AUTO_INCREMENT field. In PHP I run this

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.