I have a table:
CREATE TABLE tblproducts ( productid integer, product character varying(20) )
With the rows:
INSERT INTO tb
With postgres 9.0+ you can write:
select string_agg(product,' | ' order by product) from "tblproducts"
Details here.