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

The Archive Base Latest Questions

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

I have a mysql table, each row of which can have an arbitrary number

  • 0

I have a mysql table, each row of which can have an arbitrary number of comma-delimmited words. For example:

TABLE words
"test, dog, fun, yellow, quick, yellow"
"jogging, academic, fun, jogging, shoulder"
"shoulder, happy, flower, shoulder, shoulder"

I would like to remove the duplicate words in each row. So for example, the above would become:

TABLE words
"test, dog, fun, yellow, quick"
"jogging, academic, fun, shoulder"
"shoulder, happy, flower"

(Note that I only need to remove the duplicates in each row, by itself. I do not need to remove the duplicates between all rows.)

Any suggestions on the best way to accomplish this? Is there a better way than SELECTing and then UPDATEing through the table one row at a time?

Thanks, in advance, for your help.

  • 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-18T12:21:39+00:00Added an answer on May 18, 2026 at 12:21 pm

    This is better suited outside of SQL. It’s not going to be pretty if you try to interrogate strings using a query. I recommend:

    • SELECTing each row
    • performing an $val = explode(', ',$column);
    • switch to $val = array_unique($val);, then
    • UPDATEing to the table with implode(‘, ‘,$val);`.

    note: you can save yourself some time and do a strcmp($orig,$new) and only UPDATE if necessary.

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

Sidebar

Related Questions

In a mysql database I have table of geographical areas where each row has
I have a MYSQL table with all of the visitors to my website. Each
I used JPA and mysql. Each table have entity class.I have four tables. Table1
I have a MySQL database with multiple tables, each of which have the same
I have a MySQL database which contains a table of users. The primary key
I have a table which has no primary key and I can't add one
I have a html table which if filled by values of an mysql table.
I have a mysql table in which I store jobs to be processed. mainly
I have two tables called 'events' and 'topics' each table can have many comments.
In MySQL, I have a Student Table which contains a StudnetId column which goes

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.