Home > database >  T_ string_agg function after how to weigh?
T_ string_agg function after how to weigh?

Time:09-28

On well data, need to group after group assembled into row shows a column data, then use the string_agg function, but found that this function cannot go to follow-up the merger, there are other good method?
Select id, string_agg (distinct (name), "/")
The from student
Group by class

CodePudding user response:

Select id, string_agg (name, "/")
The from (
The select distintct XXXX
The from student
Group by class
) data

CodePudding user response:

Select id, array_to_string (the array_agg (distinct name), '/')
The from student
Group by class
  • Related