Line 20... |
Line 20... |
20 |
DROP TEMPORARY TABLE IF EXISTS T_bis;
|
20 |
DROP TEMPORARY TABLE IF EXISTS T_bis;
|
21 |
DROP PROCEDURE IF EXISTS majreferentiel;
|
21 |
DROP PROCEDURE IF EXISTS majreferentiel;
|
Line 22... |
Line 22... |
22 |
|
22 |
|
23 |
CREATE TEMPORARY TABLE IF NOT EXISTS T_bis ( INDEX(`nom`(30))) AS \
|
23 |
CREATE TEMPORARY TABLE IF NOT EXISTS T_bis ( INDEX(`nom`(30))) AS \
|
24 |
SELECT "bdtfx" AS valid_ref, CONCAT(b.nom_sci, ' ', b.auteur) AS nom, b.num_nom, b.num_taxonomique, b.famille FROM `BASESOURCE`.`TABLEBDTFX` b UNION ALL \
|
24 |
SELECT "bdtfx" AS valid_ref, CONCAT(b.nom_sci, ' ', b.auteur) AS nom, b.num_nom, b.num_taxonomique, b.famille FROM `BASESOURCE`.`TABLEBDTFX` b UNION ALL \
|
- |
|
25 |
SELECT "bdtxa" AS valid_ref, CONCAT(a.nom_sci, ' ', a.auteur) AS nom, a.num_nom, a.num_tax, a.famille FROM `BASESOURCE`.`TABLEBDTXA` a UNION ALL \
|
Line 25... |
Line 26... |
25 |
SELECT "bdtxa" AS valid_ref, CONCAT(a.nom_sci, ' ', a.auteur) AS nom, a.num_nom, a.num_tax, a.famille FROM `BASESOURCE`.`TABLEBDTXA` a;
|
26 |
SELECT "isfan" AS valid_ref, CONCAT(i.nom_sci, ' ', i.auteur) AS nom, i.num_nom, i.num_taxonomique, i.famille FROM `BASESOURCE`.`TABLEISFAN` i;
|
26 |
|
27 |
|
27 |
/* Donc nous JOINons:
|
28 |
/* Donc nous JOINons:
|
- |
|
29 |
-- INNER JOIN sur bdtfx: 62633
|
- |
|
30 |
SELECT id_observation, nom_referentiel, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, c.famille FROM `BASEEDIT`.`cel_obs` c INNER JOIN `BASESOURCE`.`TABLEBDTFX` b ON (b.num_nom = c.nom_sel_nn) WHERE nom_referentiel IS NULL AND nom_sel_nn IS NOT NULL;
|
- |
|
31 |
-- INNER JOIN sur bdtxa: 9469
|
- |
|
32 |
SELECT id_observation, nom_referentiel, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, c.famille FROM `BASEEDIT`.`cel_obs` c INNER JOIN `BASESOURCE`.`TABLEISFAN` i ON (i.num_nom = c.nom_sel_nn) WHERE nom_referentiel IS NULL AND nom_sel_nn IS NOT NULL;
|
28 |
-- INNER JOIN sur bdtfx: 69719
|
33 |
-- INNER JOIN sur isfan: 1991
|
29 |
SELECT id_observation, nom_referentiel, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, c.famille FROM `BASEEDIT`.`cel_obs` c INNER JOIN `BASESOURCE`.`TABLEBDTFX` b ON (b.num_nom = c.nom_sel_nn) WHERE nom_referentiel IS NULL AND nom_sel_nn IS NOT NULL;
|
34 |
SELECT id_observation, nom_referentiel, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, c.famille FROM `BASEEDIT`.`cel_obs` c INNER JOIN `BASESOURCE`.`TABLEISFAN` i ON (i.num_nom = c.nom_sel_nn) WHERE nom_referentiel IS NULL AND nom_sel_nn IS NOT NULL;
|
30 |
-- INNER JOIN sur bdtxa: 79471 dont 9752 en dup (bdtxa + bdtfx), eg: 1005047
|
35 |
-- INNER JOIN sur les 3 référentiels (bdtxa + bdtfx + isfan): 74093
|
Line -... |
Line 36... |
- |
|
36 |
SELECT id_observation, valid_ref, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, c.famille FROM `BASEEDIT`.`cel_obs` c INNER JOIN T_bis b ON (b.num_nom = c.nom_sel_nn) WHERE nom_referentiel IS NULL AND nom_sel_nn IS NOT NULL;
|
31 |
SELECT id_observation, nom_referentiel, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, c.famille FROM `BASEEDIT`.`cel_obs` c INNER JOIN T_bis b ON (b.num_nom = c.nom_sel_nn) WHERE nom_referentiel AND nom_sel_nn IS NOT NULL;
|
37 |
*/
|
- |
|
38 |
|
32 |
*/
|
39 |
/* mais de nombreux noms sont exactement présents dans plusieurs référentiels,
|
33 |
|
40 |
d'où GROUP BY id_observation HAVING count(id_observation) = 1,
|
34 |
/* d'où GROUP BY id_observation HAVING count(id_observation) = 1 */
|
41 |
ce qui ne produit plus que 51359 matches (soit 22734 dups) */
|
35 |
/*
|
42 |
/*
|
36 |
SELECT id_observation, nom_referentiel, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, c.famille
|
43 |
SELECT id_observation, nom_referentiel, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, c.famille
|
37 |
FROM `BASEEDIT`.`cel_obs` c
|
44 |
FROM `BASEEDIT`.`cel_obs` c
|
38 |
INNER JOIN T_bis b
|
45 |
INNER JOIN T_bis b
|
39 |
ON (b.num_nom = c.nom_sel_nn)
|
46 |
ON (b.num_nom = c.nom_sel_nn)
|
Line 40... |
Line 47... |
40 |
WHERE nom_referentiel IS NULL AND nom_sel_nn IS NOT NULL GROUP BY id_observation HAVING count(id_observation) = 1;
|
47 |
WHERE nom_referentiel IS NULL AND nom_sel_nn IS NOT NULL GROUP BY id_observation HAVING count(id_observation) = 1;
|