I need to get column values of type datetime under a condition when its
value exceeds current time. This is what I did:
my @values= $dbh->do("SELECT start_date FROM TableSLA WHERE NOW()-
Start_Date >= 0" );
This returns the number of rows that satisfied the condition instead of
returning an array of values for start_date.
Also If I have to get two column values start_date and end_date should I
say:
my (@values, @values2) = $dbh->do("SELECT start_date and end_date FROM
TableSLA WHERE NOW()- Start_Date >= 0" );
Please let me know.
Best regards
Vishwa
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Petr
Vileta
Sent: Tuesday, August 17, 2004 6:10 PM
To: ActivePerl
Subject: Re: perl and mysql add row question
> I have a column ID (integer field) as primary key in a table. When I
add
> a new row to that table, I need to first find out what is value of the
> column ID for the last row in the table, so I can increment it and add
> the new row.
Bad idea :-)
Define column ID as "int(8) auto_increment" and you needn't thinking
about
incrementation. If you can to know the ID value after last inserting
into
table, you can use SELECT LAST_INSERT_ID().
See mysql manual.
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs