1 |
#!/usr/local/bin/perl -w |
2 |
|
3 |
use DBI; |
4 |
|
5 |
my $connect = "DBI:Pg:dbname=corp"; |
6 |
my $sql="select lse.date,lse.current as lse,ftse.current as ftse |
7 |
from stocks as lse,stocks as ftse where lse.date=ftse.date |
8 |
and lse.type='LSE' and ftse.type='FTSE' |
9 |
order by date"; |
10 |
|
11 |
my $dbh = DBI->connect("$connect","","") || die $DBI::errstr; |
12 |
|
13 |
$dbh->do("set datestyle='german'") || die $dbh->errstr(); |
14 |
|
15 |
$sth = $dbh->prepare("$sql") || die $dbh->errstr(); |
16 |
$sth->execute() || die $sth->errstr(); |
17 |
|
18 |
print "#",join("\t",@{ $sth->{NAME} }),"\n"; |
19 |
while (@arr = $sth->fetchrow_array() ) { |
20 |
print join("\t",@arr),"\n"; |
21 |
} |