In my perl script I do the following:
my $sth = $dbh->prepare("SELECT MAX(Id) FROM sometable");
my $id = $sth->execute();
print "id: $id\n";
It prints 1 which I guess is the number of rows selected. I was expecting that
it would give me the highest id in that table. How can I get that? Thanks for
I have a mysql database. Lets say it has a table called "maintable" with primary
key as main_id. I want to add other tables to the database and use main_id as
foriegn keys in those tables. If I want to start with the last row of the
maintable how can I using a perl script get main_id from the la
Hi Jon,
Whatever you have suggested so far hasn't worked. I thought that maybe something
is missing in my stating the problem and implementing your suggested solutions.
So here is a more expanded picture of the queries:
$sth=$dbh->prepare("INSERT INTO TABLE1 (id,var1,var2) VALUES (?,?,?)");
$sth
Hello,
I am working on MySQL database. I have come across a 'problem' but don't know
how to get around that. The problem is the following:
I have a table, say TABLE1, with primary key being called as table1_id.
Now there are other tables, like TABLE1A, TABLE1B, TABLE1C etc.. where I want to
us