>From within MySQL 3? I doubt it. It's pretty easy to do in
the language of your choice, though. Here's a version in
perl:

use DBI;

my $dbh = DBI->connect('DBI:mysql:database=test', user, pass);

for (@{ $dbh->selectall_arrayref('SELECT * FROM users') }) {
    my ($id, @user_data) = @{ $_ };
    my $serials = "SELECT serial FROM registered_serials WHERE id = $id";

    print
      join("\t",
           @user_data,
           join(',',
                map { $_->[0] } @{ $dbh->selectall_arrayref($serials) })
          ) . "\n";
}

____________________________________________________________
Eamon Daly



----- Original Message ----- 
From: "Scott Haneda" <[EMAIL PROTECTED]>
To: "MySql" <[EMAIL PROTECTED]>
Sent: Wednesday, August 04, 2004 7:49 PM
Subject: Export and destroy relation


> A client wants access to some data in mysql 3, it is a simple case of a
user
> table and a registered_serials table, there is always one user, and there
> can be many resistered serials. (One to many)
>
> They want to somehow get this data into Excel, so I want to give them one
> record per user, even though there can be many registered_serials.
>
> The result would be something like:
> First<tab>last<tab>email<tab>serial1,serial2,serial3
>
> Is this possible?
> -- 
> -------------------------------------------------------------
> Scott Haneda                                Tel: 415.898.2602
> http://www.newgeo.com                       Fax: 313.557.5052
> [EMAIL PROTECTED]                            Novato, CA U.S.A.
>
>
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]
>


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to