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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:41:46+00:00 2026-05-22T23:41:46+00:00

table user ____________________________________________ id name nickname info_id 1 john apple 11 2 paul banana

  • 0
table user
____________________________________________
id    name    nickname    info_id
1     john    apple        11
2     paul    banana       12
3     pauline melon        13

table info
_____________________________________________
id    job         location 
11    model       usa
12    engineer    russia
13    seller      brazil

result I want
______________________________________________
1   john    apple    model     usa

my query

left join:

select * from user a left join info b on b.id = a.info_id where a.id=1

subquery:

select a.*, b.* from (user a, info b) where b.id = a.info_id

which is better?

  • 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-22T23:41:47+00:00Added an answer on May 22, 2026 at 11:41 pm
    SELECT a.`name`, a.`nickname`, b.`job`, b.`location` 
    FROM `user` AS a
    LEFT JOIN `info` AS b 
        ON ( a.`info_id` = b.`id` )
    

    That should be pretty efficient. Try using MySQL EXPLAIN if you are concerned (also make sure there are indexes on the ID fields):
    http://dev.mysql.com/doc/refman/5.1/en/using-explain.html


    UPDATE

    After seeing that you are not having performance problems just yet, I would not worry about it. “Don’t fix what ain’t broken”. If you find that it is slowing down in the future, or it is bottle-necking on that function, then worry about it.

    The query I gave should be pretty efficient.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

table: user id name ------------- 1 john 2 paul 3 mattew table: nickname id
I have two tables user table user_id | name | 1 | peter |
I have a table: **user** id, name, points Can you suggest me how to
I've an old table like this: user> id | name | address | comments
Given table USER (name, city, age), what's the best way to get the user
I have a role table with user name and role and company. I want
I have user table having fields gender and first name like this.. The value
I've following data table structure - User ID | User Name | Manager ID
I have a sql-file containing several statements like this: create table user ( name
Suppose I have a table as follows in MySQL: create table user(name varchar(20), join_time

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.