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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:18:44+00:00 2026-06-13T18:18:44+00:00

Example table1: id | field1 | field2 ——————– table2: id | id1 | field1

  • 0

Example table1:

id | field1 | field2
--------------------

table2:

id | id1 | field1 | field2
--------------------------

Is it possible to do this:

select t1.*, t2.* from table1 t1 inner join table2 t2 on t1.id = t2.id1

and receive this result:

t1_id | t1_fiedl1 | t1_field2 | t2_id | t2_id1 | t2_fiedl1 | t2_field2
----------------------------------------------------------------------

The goal is to make mysql auto add prefixes to resulting fields, to avoid long typings, such as

select t1.id as t1_id, t1.field1 as t1_field1

and so on

  • 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-06-13T18:18:46+00:00Added an answer on June 13, 2026 at 6:18 pm

    The SQL engine will not rewrite your query to “auto-alias” fields for you — aliases must be explicit.

    You have two options in client code, however.

    First, you could obviously write an abstraction that pieces together the query and provides aliases while doing so.

    Second, and easier, is using the information exposed in the underlying MYSQL_FIELD structures associated with each result set. These contain the field and table name (and other information) about each field, allowing you to stitch together t1_field1 programmatically and without knowing field names in advance. How this info is exposed depends on your particular client API.

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

Sidebar

Related Questions

I have a select statement like this select field1, field2 from table1 What I
Are these two statements equivalent? UPDATE Table1 SET Field1=( SELECT Field2 FROM Table2 WHERE
How to select only one field from table inside a model. For example: table1(field1,
How to select only one field from table inside a model. For example: table1(field1,
I have this query: SELECT Field1 AVG(Field2) as Field2, AVG(Field3) as Field3, AVG(Field4) as
I would like to expand on this simple sub select: Select * from table1
For example, I have a table TableA, with columns Field1, Field2 and Field3. My
The database type is PostGres 8.3. If I wrote: SELECT field1, field2, field3, count(*)
I have 2 tables in my database, for example: Table1: id (PK), data1 and
For example, let's say I have the following two tables: Table1: Id ---- 1

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.