[snip]
I made a query: the result are given back to me. Now I want to perform
another query within these results.
[/snip]
I am pretty new to mysql (I have only been playing with it for about 2 weeks
now), but I had a similar problem and I recommend using a simple Perl script
(using the DBI module).
Here is an example of a script that does a simple query and extracts the
results (which can then be used for another query)
# -------> Set up necessary variables <--------- #
my $db="User_Information";
my $server="localhost";
my $field_name="user_name_id";
my $db_name="User_Name";
my $field_name="last_name";
my $data_value="Doe";
# -------> Make a connection to the server <--------- #
$dbh = DBI->connect("dbi:mysql:$db:$server", $username, $password,
{ RaiseError => 1 });
# Set up a query to send to the database
$query = "SELECT $id FROM $db_name WHERE $field_name=\'$data_value\'
";
# ---------> Prepare and execute the query <------- #
$sth = $dbh->prepare($query);
query:$sth->execute();
# ---------> Recieve result from query <------- #
$id_from_db = $sth->fetchrow_arrayref;
# --------> Finish up transaction and disconnect from database
<------- #
$sth->finish();
$dbh->disconnect() || die "couldn't close database: $!";
Hope that helps!
-----Original Message-----
From: W. Enserink [mailto:enserink@stripped]
Sent: Monday, June 17, 2002 8:33 AM
To: mysql@stripped
Subject: queries within queries
hi all,
I made a query: the result are given back to me. Now I want to perform
another query within these results.
Is this possible?
thx for all tips.
regards Wilbert
-------------------------
Pas de Deux
Van Mierisstraat 25
2526 NM Den Haag
tel 070 4450855
fax 070 4450852
http://www.pdd.nl
info@stripped
-------------------------
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <mysql-thread112182@stripped>
To unsubscribe, e-mail
<mysql-unsubscribe-Robert.Casey=fmr.com@stripped>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php