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.
Well given you alter the table and add the new column ParentID ?
Something like