>From: blue.trapezius@stripped [mailto:blue.trapezius@stripped] On
>Behalf Of Vikram Vaswani
>Sent: Monday, January 26, 2009 7:02 AM
>Subject: Help with formatting of 1:n relationship
>I have a database with a 1:n relationship as follows:
>My client wants me to export these linked records into an Excel file in
>the following format.
>item.fld1 item.fld2 ... item_info.fld1 item_info.fld2 ...
>item_info.fld1 item_info.fld2 ..
>ie. each item and all the records that make up its info together in a
>single Excel row.
>I'm using an excel library that accepts a SELECT as input and generates
>an XLS file with the records as output. I'd like to use this where
>possible. However I don't know if it's possible to write a SELECT that
>compresses a 1:n relationship into a single row. Is this possible, and
>if yes, could someone show me how? Or could you suggest another way in
>which I could achieve the above required output?
[JS] I do something similar with a GROUP BY and GROUP_CONCAT(), but that
would put all of your "n"s into one field. In my case, that's what I want;
but it doesn't exactly solve yours because MySQL doesn't seem to have an
Does whatever tool you are using have any place where you can manipulate the
data between the SELECT and the creation of the XLS? If not,I think you need
a user-defined function for this, or perhaps you can do it with a
Probably someone has a better idea.
>Operator: "So what do you need? Besides a miracle."
>Neo: "Guns. Lots of guns."
> -- The Matrix
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe: http://lists.mysql.com/mysql?unsub=1