By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,180 Members | 1,051 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,180 IT Pros & Developers. It's quick & easy.

SQL Q: Concatenate multiple rows on same column.

P: n/a
I have a concatenation problem and I was wondering if somebody might be
able to offer some help :-)

I have the following table structure holding product long descriptions:

Part No (pn) Sequence (seq) Long Description (long_desc)
--------------- --------------- ----------------------------------------
HL1450 10 This is part of a long description and
HL1450 20 it overlaps onto several lines. I'm
HL1450 30 having difficulty writing the SQL that
HL1450 40 is needed to make this work...
I need to write SQL that will give me the following output:

Part No Long Description
--------------- --------------------------------------------------------
HL1450 This is part of a long description and it overlaps onto
several lines. I'm having difficulty writing the SQL that is needed
to make this work...

(Essentially it a GROUP BY on the part number with an ORDER by on the
sequence field). However, I know how to concatenate multiple columns on
the same row (using the CONCAT or CONCAT_WS functions) but I'm at a loss
over how to concatenate the same column over multiple _rows_

I am aware of the GROUP_CONCAT function, but we are currently running
MySQL 4.0.13 (this functionality is only available on a vers > 4.1)

If any one has a suggestion as how I should go about this one I would
really appreciate it.

Kind regards, Nick

--
Nick Heppleston
07989 581766 | ni************@gmx.co.uk

The Funky PC - http://www.thefunkypc.biz

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.