Ajout des batchs
This commit is contained in:
parent
9a70310c6a
commit
9fb82f87a1
22
batchs/setMinMax.php
Normal file
22
batchs/setMinMax.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
$db_230 = mysql_connect('192.168.78.230', 'sphinx', 'indexer');
|
||||
mysql_select_db('jo', $db_230);
|
||||
|
||||
$localhost = mysql_connect('127.0.0.1', 'root', '');
|
||||
mysql_select_db('sdciblage', $localhost);
|
||||
|
||||
$keys = array(
|
||||
'nbActio','nbPart', 'teff_entrep', 'teff_etab', 'nbEtab',
|
||||
'eff_entrep', 'eff_etab', 'capital', 'bilEE', 'bilFL', 'bilFK', 'bilFR', 'bilGF',
|
||||
'bilGP', 'bilGW', 'bilHD', 'bilHH', 'bilHL', 'bilHM', 'bilHN', 'bilYP'
|
||||
);
|
||||
mysql_query('TRUNCATE TABLE minmax', $localhost) or die ('Impossible de vider la table minmax');
|
||||
foreach($keys as $key) {
|
||||
$sql = 'SELECT MIN('.$key.') AS min, MAX('.$key.') AS max FROM etablissements_act';
|
||||
$query = mysql_query($sql, $db_230);
|
||||
$result = mysql_fetch_assoc($query);
|
||||
$sql = 'INSERT INTO minMax VALUES ("'.$key.'", '.$result['min'].', '.$result['max'].')';
|
||||
mysql_query($sql, $localhost) or die(mysql_error($localhost));
|
||||
print($key.'-> min:'.$result['min'].' max:'.$result['max']."\n");
|
||||
}
|
||||
print('Terminé');
|
5
batchs/table.sql
Normal file
5
batchs/table.sql
Normal file
@ -0,0 +1,5 @@
|
||||
CREATE TABLE `minMax` (
|
||||
`key` INTEGER PRIMARY KEY NOT NULL,
|
||||
`min` INTEGER NOT NULL,
|
||||
`max` BIGINT NOT NULL
|
||||
);
|
Loading…
Reference in New Issue
Block a user