[Cascavel-pm] Sugestao - PERL

Patty Silva ptfzs em yahoo.com.br
Segunda Outubro 1 04:28:08 PDT 2007


Pessoal.. uma sugestao de vcs..
estou fazendo um programa que recupera o ID e ultima datahora que foi inserido no banco..e busco as ultimas 48 horas para aquela ID...
Estou fazendo:


.
.
.

my $sql=qq{SELECT id,MAX(datahora) from table1 where datainc>=
timestamp '$aaaammdd $hour:00:00' - interval '3 hour' GROUP BY id ORDER BY id};

$sth = $dbh->prepare($sql) || die $DBI::errstr;
$sth->execute || die $DBI::errstr;


while ( my @row = $sth->fetchrow_array( ) )
{

                           

my $sql2=qq{SELECT * from table1 where id='$row[0]' and datahora>=timestamp '$row[1]' - interval '48 hour' order by datahora};

                            $sth2 = $dbh->prepare($sql2) || die $DBI::errstr;
                            $sth2->execute || die $DBI::errstr;

                            while ( my @row2 = $sth2->fetchrow_array( ) )
                           {
                               .. . ................
                           }
                        }

                        warn "Problema ao processar os resultados", $sth->errstr( ), "\n" if $sth->err( );
                        $sth->finish();
                        $sth2->finish();



Alguma sugestao:??? um problema eh que a 1 consulta demora d+.. :D

Obrigada


       Abra sua conta no Yahoo! Mail, o único sem limite de espaço para armazenamento! 
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: http://mail.pm.org/pipermail/cascavel-pm/attachments/20071001/c79044c0/attachment.html 


Mais detalhes sobre a lista de discussão Cascavel-pm