i have two joined table in my postgres db
tb_items and tb_colors
id_item | group |id colors
--------------------------
1 a 1
2 b 1
3 b 2
4 c 4
5 c 5
id_color | color| subcolor
---------------------------------
1 black var1
2 red type1
3 red type2
4 blue aaa1
5 blue xxx3
6 red hex1
that mean in my query i have
id_item | group | color | subcolor
----------------------------------
1 a black var1
2 b red type1
3 b red type2
4 c blue aa1
5 c red hex1
basically what i want is renaming color name based on numers of color item in a groups or
id_item | group | color
----------------------------------
1 a black
2 b red
3 b red-1
4 c blue
5 c red
i dont' really know whato to do..