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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:21:39+00:00 2026-05-23T20:21:39+00:00

I have an items Table and a Tags table. Now what I would like

  • 0

I have an items Table and a Tags table. Now what I would like is to have one Select that gets Items under a certain condition and for each item selects the related tags and puts them in a string to become a seperate field.

Example:

table_items:
id   | title
---------------------------
01   | peter
---------------------------
02   | john
---------------------------
03   | cindy

tags:
id   | title
---------------------------
01   | tall
---------------------------
02   | tiny
---------------------------
03   | blone
---------------------------
04   | loud
---------------------------
05   | ...

tags_to_items:
itemid | tagid
---------------------------
01     | 02
---------------------------
01     | 04
---------------------------
02     | 01
...

I think you get the point.

Now I want a result like this:
itemid | title   | tags
---------------------------
01     | peter   | tiny, loud
---------------------------
01     | john    | tall, fast, bored

Can I do this with just MySQL?
How?

  • 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-23T20:21:39+00:00Added an answer on May 23, 2026 at 8:21 pm

    In MySQL, you need GROUP_CONCAT function to do that.

    Something like:

    select ti.id, ti.title, group_concat(t.title)
      from table_items ti
     inner join tag_to_items tti on (ti.id = tti.itemid)
     inner join tags t on (t.id = tti.tagid)
     group by ti.id, ti.title
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table of items, each of which has a date associated with
I'm working on an asp.net-mvc project. I have an Items table and a Tags
I have two tables. One is items , and one is tags . Query's
I need an sql query that will retrieve all items that have both tags,
Suppose I have table tags which has a field count that indicates how many
I have 3 tables: Foods table stores all food items, Tags table stores all
I have a database of items (articles for that matter). What I'd like to
I have a items table with 1 million rows and a users table with
I have a table Users and a table Items In the Items table, I
If I have an Invoice Line Items table and a Products table, and I

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.