-1

I have a table as follows

+----------------+----------+--------+  
| purchase_order | text_seq |  text  |  
+----------------+----------+--------+  
|           1001 |        1 | screw  |  
|           1001 |        2 | m5x10  |  
|           1001 |        3 | socket |  
|           1002 |        1 | washer |  
|           1002 |        2 | m5x10  |  
+----------------+----------+--------+  

From view need to get data as follows

+----------------+-------------------------+
| Purchase_order |          text           |
+----------------+-------------------------+
|           1001 | screw,m5x10,socket head |
|           1002 | washer,m5               |
+----------------+-------------------------+
roice
  • 1
  • Need more information. Not really sure what you are trying to do. – mirtheil Mar 19 '12 at 11:12
  • [text as table](http://www.sensefulsolutions.com/2010/10/format-text-as-table.html) is your friend. Also, please [edit] and clarify your question. –  Mar 19 '12 at 14:56

1 Answers1

0

There's not an easy way to do what you want. If you are using a recent version of PSQL, you can create a stored procedure or function to create the "text" field in the order you want (based on text_seq I would guess) and then use that result in the overall results.
My personal preference would be to retrieve the results from the database and then format them to my needs.

mirtheil
  • 8,952
  • 1
  • 30
  • 29