Hi, I have a script (below) and rather than cycle through each row of the table I would like to just return the first row. Is this possible?
my $query="SELECT severity, source, displayname FROM alert WHERE displ +ayname LIKE '%$displayname%' ORDER BY severity DESC"; my $sth=$dbh->prepare($query); $sth->execute(); #Loop through for each row returned while ( @row = $sth->fetchrow_array ) { $severity = $row[0]; $source = $row[1]; $displayname = $row[2]; print "$severity\n"; }
Thanks
In reply to returning first row of SQL query by whittick
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |