1 |
root |
1.1 |
#!/usr/bin/perl |
2 |
|
|
|
3 |
|
|
use PApp::SQL; |
4 |
|
|
|
5 |
|
|
local $PApp::SQL::DBH = PApp::SQL::connect_cached "dinfo::", "DBI:mysql:dinfo"; |
6 |
|
|
|
7 |
|
|
for my $col (qw( |
8 |
|
|
name |
9 |
|
|
vorname |
10 |
|
|
zusatz1 |
11 |
|
|
zusatz2 |
12 |
|
|
zusatz3 |
13 |
|
|
vorwahl |
14 |
|
|
strasse |
15 |
|
|
haus |
16 |
|
|
plz |
17 |
|
|
ort |
18 |
|
|
branche |
19 |
|
|
)) { |
20 |
|
|
my ($id, $count) = sql_fetch "select $col, count(*) from row group by 1 order by 2 desc limit 1"; |
21 |
|
|
warn "$col => ($id) * $count\n"; |
22 |
|
|
next unless $id; |
23 |
|
|
warn "update $col set id = 0 where id = ?", $id; |
24 |
|
|
warn "update row set $col = 0 where $col = ?", $id; |
25 |
|
|
} |
26 |
|
|
|