in reply to returning first row of SQL query

Is there a reason why you cannot put LIMIT 1 (or TOP 1 or whatever your server dialect requires) into your SQL query?

Anyway, $sth->finish discards the rest of the rows.

Replies are listed 'Best First'.
Re^2: returning first row of SQL query
by whittick (Acolyte) on Mar 29, 2012 at 12:08 UTC

    LIMIT 1 works perfectly, sorry I hadn't thought of solving the problem with SQL rather than through perl!