Leser: 1
2 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
se WIN32::ODBC;
my @Anlagen = ( 'bvs100', 'bvs102', 'bvs103', 'bvs105', 'bvs106');
foreach (@Anlagen) {
my $DSN = $_;
my $DSN2 = "statistik";
my ($sekunde, $minute, $stunde, $day, $month, $year) = (localtime(time))[0..5];
$month++;
$year += 1900;
$day = "0".$day if $day < 10;
$month = "0".$month if $month <10;
$sekunde = "0".$sekunde if $sekunde <10;
$minute = "0".$minute if $minute <10;
$stunde = "0".$stunde if $stunde <10;
if (!($db = new Win32::ODBC($DSN))){
print "Error connecting to $DSN\n";
print "Error: " . Win32::ODBC::Error() . "\n";
exit;
}
if (!($db2 = new Win32::ODBC($DSN2))){
print "Error connecting to $DSN2\n";
print "Error: " . Win32::ODBC::Error() . "\n";
exit;
}
if ($db->Sql("SELECT ItemStatusID, Date from Item_Statistics")){
print "SQL failed. \n";
print "Error: " . $db->Error() . "\n";
exit;
}
while ($db->FetchRow()){
undef %Data;
%Data = $db->DataHash();
if ($db2->Sql("INSERT INTO statistik (anlage, status, datum) VALUES ('".$_."', ".$Data{"ItemStatusID"}.", '".$Data{"Date"}."')")) {
print "SQL failed. \n";
print "Error: " . $db2->Error() . "\n";
}
}
$db->Close();
$db2->Close();
}
<>
1
2
3
4
SELECT statistik.anlage, Format(Format([datum],"ww"),"00") AS KW, Count(statistik.datum) AS [Anzahl von datum]
FROM statistik
WHERE (((statistik.status)=1))
GROUP BY statistik.anlage, Format(Format([datum],"ww"),"00");
1
2
3
4
5
TRANSFORM Sum([KW-Statistik].[Anzahl von datum]) AS [Summe von Anzahl von datum]
SELECT [KW-Statistik].KW, [KW-Statistik].Erfolg, Sum([KW-Statistik].[Anzahl von datum]) AS Summe
FROM [KW-Statistik]
GROUP BY [KW-Statistik].KW, [KW-Statistik].Erfolg
PIVOT [KW-Statistik].anlage;
1
2
SELECT *, 'erfolgreich' as Erfolg from [KW-Statistik 1]
UNION SELECT *, 'nicht erfolgreich' as Erfolg from [KW-Statistik 9];
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<html>
<head></head>
<body>
<form action="//" method="post">
<select name="datum" size="1"><option value="%">(alle)</option>
<option>KW01</option><option>KW02</option><option>KW03</option>
<option>KW04</option><option>KW05</option><option>KW06</option>
<option>KW07</option><option>KW08</option><option>KW09</option>
<option>KW10</option><option>KW11</option><option>KW12</option>
<option>KW13</option><option>KW14</option><option>KW15</option>
<option>KW16</option><option>KW17</option><option>KW18</option>
<option>KW19</option><option>KW20</option><option>KW21</option>
<option>KW22</option><option>KW23</option><option>KW24</option>
<option>KW25</option><option>KW26</option><option>KW27</option>
<option>KW28</option><option>KW29</option><option>KW30</option>
<option>KW31</option><option>KW32</option><option>KW34</option>
<option>KW35</option><option>KW36</option><option>KW37</option>
<option>KW38</option><option>KW39</option><option>KW40</option>
<option>KW41</option><option>KW42</option><option>KW43</option>
<option>KW44</option><option>KW45</option><option>KW46</option>
<option>KW47</option><option>KW48</option><option>KW49</option>
<option>KW50</option><option>KW51</option><option>KW52</option>
<option>KW53</option></select>
<select name="standort" size="1"><option value="%">(alle)</option>
<option>ZB</option><option>DP</option></select>
<select name="Anlage" size="1"><option value="%">(alle)</option><option>BVS100</option>
<option>BVS102</option><option>BVS103</option><option>BVS104</option><option>BVS105</option>
</select>
<input name="action" value="Go" type="submit"><p></p><hr><p></p>
</form>
</body>
</html>
1
2
3
4
5
6
7
8
use DBI;
my $file = "c:\\\\mydir\\\\myAccess.mlb";
my $dsn = 'driver=Microsoft Access Driver (*.mdb);dbq=' . $file;
my $user = '';
my $pass = '';
my $dbh = DBI->connect("dbi:ODBC:$dsn", $user, $pass);
or die "Error in connect: $DBI::errstr\n";
2 Einträge, 1 Seite |