472,353 Members | 1,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

merge multiple records into 1

What would be the best way to "flatten" a set of records into one column with a query?

example:

You have a table called tbletters

id letters
1 a
2 b
3 c
4 d

So I can return this as one column in one record

a,b,c,d


---------------------------(end of broadcast)---------------------------TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to ma*******@postgresql.org so that your message can get through to the mailing list cleanly

Nov 11 '05 #1
2 2708
On Sat, Aug 23, 2003 at 20:16:51 -0400,
Brian Maguire <bm******@vantage.com> wrote:
What would be the best way to "flatten" a set of records into one column with a query?

example:

You have a table called tbletters

id letters
1 a
2 b
3 c
4 d

So I can return this as one column in one record

a,b,c,d


You could write an aggregate function that concatenates strings. There should
even be examples of some code that does this in the archives from within
the last 6 months.

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 11 '05 #2
CoL
Hi,

how about tablefunc_crosstab from contrib/tablefunc ?

Brian Maguire wrote, On 8/24/2003 2:16 AM:
What would be the best way to "flatten" a set of records into one column with a query?

example:

You have a table called tbletters

id letters
1 a
2 b
3 c
4 d

So I can return this as one column in one record

a,b,c,d

C.

Nov 11 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Morris | last post by:
Does anyone know whether it is possible to effect a mail merge to MSWord using VBScript in an asp file? I know it is possible to produce a doc...
3
by: Steve | last post by:
I have a people table of about 25 fields. The table is initially created each year from 5 different sources. The records from each source are...
0
by: DS | last post by:
Hi Guys (and ladies): I have a parameter query in A2K that asks for records based on certain criteria. It returns the name and address fields of...
3
by: svdh2 | last post by:
I have been looking at a problem the entire week in access, I have still not been able to find a solution. Hope that you could maybe tell where to...
8
by: dd_bdlm | last post by:
Hi I wonder if anyone can help? I have looked through prevous posts and cant find any answers that fit what I need to do. For reference I am using...
1
by: achintya.jha | last post by:
Hi, I am currently working hard to print Word labels from ASP.NET I have multiple records which I need to print on to a word label print...
1
by: law | last post by:
I love the super easy word merge but I have a question. In my database I select multiple records which I then want to merge to a single document...
3
by: cdelarte | last post by:
I would like to be able to mail merge records from multiple mysql tables using a simple template, preferably via a command line script. MSWord...
6
by: crealesmith | last post by:
Firstly, I have no problem with mail merging to Word, VB code for that works perfectly. On one mail merge I need to merge 15 fields of data that...
1
by: kirkus84 | last post by:
I am currently trying to do a multiple record mail merge through a query via a command button on a form. The query basically displays customers who...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.