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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:33:42+00:00 2026-05-29T15:33:42+00:00

I currently have database setup like so: CREATE TABLE `article` ( `id` int(11) NOT

  • 0

I currently have database setup like so:

CREATE TABLE `article` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` int(11) NOT NULL,
  `body` int(11) NOT NULL,
  `link` int(11) NOT NULL,
  `date` datetime NOT NULL,
  PRIMARY KEY (`id`)
)

CREATE TABLE `translation_pivot` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `content` text,
  PRIMARY KEY (`id`)
)

This is quite a simplified version to illustrate the question, essentially the translation_pivot is used to further look up text strings from a series of language tables, but’s that’s not relevant. Here, the title, body and link columns in article contain an id referencing content from translation_pivot.

The difficulty is that doing an INNER JOIN will result in a column called content, which will contain only the first match from translation_pivot, in this case title.

The other option I’ve looked into is using GROUP_CONCAT on translation_pivot.content. This will work but then I’m left with a comma separated list of items and lose the obvious relation to title, body and link other than as the first, second and third items (which is ok, but not great). The more serious problem is that items in the translation can be several paragraphs of text. The default value for group_concat_max_len is 1024, which I can change but does this have performance implications if set to high values?

Ideally I’d like a way of replacing the title, body and link columns with the textual result from translation_pivot, or at least getting the textual content back for each as a separate column. Is this possible in a single query?

My other alternative is to retrieve key, value pairs as an array from translation_pivot with the id as the key and then do a lookup after querying the articles. This is only an extra query and probably a lot simpler.

Which solution will scale best? Or is there something else I’m missing?

  • 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-29T15:33:42+00:00Added an answer on May 29, 2026 at 3:33 pm

    Just do multiple joins:

    SELECT
      article.id AS id,
      tptitle.content AS title,
      tpbody.content AS body,
      tplink.content AS link,
      article.`date` AS `date`
    FROM
      article
      INNER jOIN translation_pivot AS tptitle ON article.title=tptitle.id
      INNER jOIN translation_pivot AS tpbody ON article.body=tpbody.id
      INNER jOIN translation_pivot AS tplink ON article.link=tplink.id
    

    or:

    SELECT
      article.id AS id,
      IFNULL(tptitle.content,'DEFAULT TITLE') AS title,
      IFNULL(tpbody.content, 'DEFAULT BODY') AS body,
      IFNULL(tplink.content, 'DEFAULT LINK') AS link,
      article.`date` AS `date`
    FROM
      article
      LEFT jOIN translation_pivot AS tptitle ON article.title=tptitle.id
      LEFT jOIN translation_pivot AS tpbody ON article.body=tpbody.id
      LEFT jOIN translation_pivot AS tplink ON article.link=tplink.id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a table like so: CREATE TABLE big_table (UUID varchar(32) not null,
Currently we have a hybrid ASP/PHP setup connecting to a SQL Server 2005 database.
currently I'm trying to have a setup where a generic database is distributed to
I currently have a database that gets updated from a legacy application. I'd like
I currently have a Postgres 8.4 database that contains a varchar(10000) column. I'd like
I currently have a MongoDB setup with a fairly large database (about 250m documents).
I have a database table that holds parent and child records much like a
Currently I have database with the following associations: One Client to Many Intakes One
I currently have an existing database and I am using the LINQtoSQL generator tool
I currently have a SQL Server (Express 2005) database to hold some transaction/metadata that

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.