in reply to dbi retieve single col value

To select every value of tax_id only once, use
SELECT DISTINCT tax_id FROM gene2acc WHERE genomic_ac_ver = ?
or
SELECT tax_id FROM gene2acc WHERE genomic_ac_ver = ? GROUP BY tax_id

Replies are listed 'Best First'.
Re^2: dbi retieve single col value
by Anonymous Monk on Aug 28, 2008 at 13:03 UTC
    Hi thanks I tried this way,it still does not enter the while loop to print the statement:print "Entering taxID_format with $t\n";
    LOOP:foreach $ref(@ref) { print "in foreach loop with $ref\n"; $count=0; $command1 = qq{select distinct tax_id from gene2acc where genomic_ac +_ver= '$ref'; }; $sth1=$dbh->prepare($command1); $sth1->execute() or die $sth1->errstr; my($tax_id); $sth1->bind_columns(undef,\$tax_id ); while($sth1->fetch()) { $t=$tax_id; print "Entering taxID_format with $t\n"; #&taxID_format($t); }
    please help me