SELECT * FROM mytable WHERE age = ?
And this will select just one column:
SELECT firstname FROM mytable WHERE age = ?
In the case of the second SQL statement, fetchrow_array() will return an array of one single element.
There is a pretty good basic SQL tutorial at http://www.w3schools.com/sql/default.asp.
Another alternative is the $slice parameter of the fetchall_arrayref() method. By passing an anonymous arrayref containing the element numbers you're after, you can "slice" the arrayref for each row so that only certain columns are seen. This is documented in DBI.
|