Quote:
Originally Posted by mattdoughty
Hi Forum,
I'm trying to perform a type of concatenate function on a table and am not really sure where to start. I'd like to aggregate the values from 'field' on their ID. To explain, my table is like this:
ID roadnum
1 A-1
2 B-1
2 E-1
3 N-1
4 N-3
4 E-2
4 CA-1
5 E-1
Which I'd like to transform to:
ID roadnum
1 A-1
2 B-1 / E-1
3 N-1
4 E-2 / CA-1 / N-3
5 E-1
I've been looking at various lists and forums but I've not been able to follow the explanations. Further down the line, instead of simply concatenating the field values, I'd like to concatenate according to the road importance- which is based on the roadnum, but one step at a time. When I have the values in the same field, I'll worry about the next step.
Matt
you can use the array data tye
make the roadnum attribute an array and append the routes in the last
check array data type from postgreSQL documentation
but be careful as when you will select the array from databse using php or ny other language it will return only a string {value1,value2...}
so iterate nd make it an array
shoonya