Мускул 5.1
Есть код:
Код: Выделить всё
my $dsn = 'DBI:mysql:base:127.0.0.1';
my $db_user_name = 'aga';
my $db_password = 'ogo';
my $dbh = DBI->connect($dsn, $db_user_name, $db_password);
my $sgo = $dbh->prepare(qq{
SELECT tarifs_history.tar_id_old, tarifs_history.tar_id_new,tarifs_history.changed,tarifs.descr
FROM tarifs_history,tarifs
WHERE
tarifs_history.tar_id_new=tarifs.tar_id
AND tarifs_history.changed > '2008-08-01 00:00:00'
AND tarifs_history.changed < '2008-08-01 23:59:59'
AND tar_id_new > 108
AND tar_id_new < 121
});
$sgo->execute();
while (my ($tarold,$tarnew,$chang,$descr)=$sgo->fetchrow_array())
{
open (LOGF, ">>/usr/home/admin/changed") || die "$!";
print LOGF "$chang\t$descr\n";
close (LOGF);
}
Код: Выделить всё
INSERT INTO `tarifs` (`tar_id`, `descr`, `cur_id`, `rent`, `block_rent`...`) VALUES
...
(1, 'Тариф 250', ..., NULL),
(53, 'Тариф 450', ..., NULL),
...
Код: Выделить всё
INSERT INTO `tarifs_history` (`tar_id`, `vg_id`, `tar_id_old`, `tar_id_new`, `c_date_new`, `rasp_time`, `changed`, `request_by`) VALUES
...
(22, 4111, 1, 53, '0000-00-00', '2008-08-01 22:33:05', '2008-08-01 22:33:05', 0),
(23, 3957, 1, 53, '0000-00-00', '2008-08-01 19:18:53', '2008-08-011 19:18:53', 0),
...