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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:04:54+00:00 2026-06-07T00:04:54+00:00

I have two tables images2 and image_data So the goal is to have 1

  • 0

I have two tables images2 and image_data

enter image description here
enter image description here

So the goal is to have 1 table for ALL the image uploads (images2) and then the image_data is to assign that image with different options.

So for example, here is some sample data:

enter image description here

So image_id 10 has more than one row, because this image is associated with both TN and CQ. And they could also be associated with more than one language and slide, so I would add on to the second row and change slide_id or language_id .. if wanted to add more, than I would add a new row for it.

The goal is to have a list of all the images, and then when you click on it it pops up and you can edit the options and change it straight from there.

enter image description here

I need help writing a query. The one I have right now:

SELECT images2.id, images2.filename, image_data.slide_id, image_data.language_id,
image_data.type FROM images2 
LEFT JOIN image_data ON images2.id = image_data.image_id

A couple things wrong with that query.. It is showing the duplicates, because image_id 10 has two rows.

enter image description here

But I need that second row of image #10 because I need to see that it is also associated with CQ so I can check the checkbox when it pops up.

So I need to create a query to show ALL the unique images no duplicates, with all of the options it has.

I’m not sure the best way to do this.. do I need to re-do the way my database tables are? Any help is appreciated.

Thanks.

  • 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-07T00:04:55+00:00Added an answer on June 7, 2026 at 12:04 am

    What you could do is use GROUP_CONCAT() to turn values in multiple rows into a single concatenated string. The following retrieves the ids of slides and languages as well as their names to better facilitate your form.

    SELECT
        a.id,
        a.filename,
        GROUP_CONCAT(CONCAT(b.slide_id, '::', c.slide_name)) AS slides,
        GROUP_CONCAT(CONCAT(b.language_id, '::', d.language_name)) AS languages,
        GROUP_CONCAT(b.type) AS types,
    FROM 
        images a
    LEFT JOIN
        image_data b ON a.id = b.image_id
    LEFT JOIN 
        slides c ON b.slide_id = c.id
    LEFT JOIN
        languages d ON c.language_id = d.id
    GROUP BY
        a.id
    

    Your result set for image 10 will look something like:

    id    |    image_filename    |    slides    |    languages    |    types
    -------------------------------------------------------------------------
    10    |    p170sfhe...       |    5::slide5 |    1::language1 |    TN,CQ
    

    In php, just explode() the strings based on the delimiters.

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

Sidebar

Related Questions

Basically I have a database with two tables, that is, Updates table and Images
I have two tables, image and video . I want to display all data
I have two tables, images and image_data and here is an example of my
I have two tables, content and images (and a ContentImages table for the one
I have two tables: table a ida valuea 1 a 2 b 3 c
I have two tables one with ID and NAME table 1 ID | NAME
Should a database table that contains two columns that are foreign keys have a
In the past, I've handled user image uploads in two different ways: Save the
I have two tables, a vehicle table with columns: id stock year make model
I have an SQL Server table that contains two columns - an integer ID

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.