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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:07:10+00:00 2026-06-11T09:07:10+00:00

I have one table id | title | … ––—————- 1 | test A

  • 0

I have one table

id |  title  | ...
––----------------
 1 |  test A | ...
 2 |  test C | ...
 3 |  test B | ...
 4 |  test C | ...
 5 |  test B | ...
 6 |  test X | ...

And I want to add a column based on GROUP BY query : SELECT * FROM table GROUP BY title

id |  title  | group_id (int)
––--------------------------
 1 |  test A | 1
 2 |  test C | 2
 3 |  test B | 3
 4 |  test C | 2
 5 |  test B | 3
 6 |  test X | 4

group_id doesn’t need to be significant, it just have to be the same value on the row which have the same title value and different from the other.

How can I do this ?

Thanks.

PS: Sorry for my English, I’m french.

  • 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-11T09:07:11+00:00Added an answer on June 11, 2026 at 9:07 am

    Well given you alter the table and add the new column ParentID ?
    Something like

    UPDATE ATable t
      INNER JOIN (
        SELECT
          Title, 
          MIN(ID) AS ID
        FROM ATable
        GROUP BY Title
      ) m ON t.Title = m.Title
    SET t.ParentID = m.ID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to select everything from table one, which contains a column JID. These
I have creted one dynamic temp-table and dynamic query.Now I want to populate it
I have one table Books, with a column genres where I want to reference
i have in one table two fields (title, content) and i inserted some values...:
As in title. I have one column which has some text values. For example
I have one table: horse ->id ->course ->date Another one: course ->title ->trackstyle And
Up until now I have just been using one table in a MySQL query,
I have one table orders with a foreing key ProductID. I want to show
I want to insert some session data in a database. I have one table
I have a successful query that currently returns all data except for one table.

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.