623 |
jpm |
1 |
DROP VIEW IF EXISTS cel.cel_tapir;
|
622 |
jpm |
2 |
CREATE ALGORITHM=UNDEFINED DEFINER=`telabotap`@`localhost` SQL SECURITY DEFINER
|
|
|
3 |
VIEW `cel_tapir` AS
|
|
|
4 |
SELECT
|
623 |
jpm |
5 |
CONCAT(_utf8'urn:lsid:tela-botanica.org:cel:',i.id) AS guid,
|
|
|
6 |
i.id AS observation_id,
|
|
|
7 |
DATE_FORMAT(i.date_observation, '%Y-%m-%d') AS observation_date,
|
|
|
8 |
i.nom_sel AS nom_scientifique_complet,
|
|
|
9 |
i.num_nom_sel AS nom_num_nomenclatural,
|
|
|
10 |
i.num_taxon AS nom_num_taxonomique,
|
|
|
11 |
i.famille AS nom_famille,
|
|
|
12 |
CONCAT(_utf8'', l.name, ' [INSEE:', l.insee_code, ']') AS lieu_commune_nom_complet,
|
|
|
13 |
l.name AS lieu_commune_nom,
|
|
|
14 |
l.insee_code AS lieu_commune_code_insee,
|
|
|
15 |
concat(l.sector,' ',l.x_utm,'m E ',l.y_utm,'m N') AS lieu_commune_utm_coordonnees_bruts,
|
|
|
16 |
l.sector AS lieu_commune_utm_zone,
|
|
|
17 |
l.x_utm AS lieu_commune_utm_x,
|
|
|
18 |
l.y_utm AS lieu_commune_utm_y,
|
|
|
19 |
i.lieudit AS lieu_localite,
|
|
|
20 |
i.identifiant AS observateur_courriel,
|
|
|
21 |
IF(i.commentaire = 'null', NULL, i.commentaire) AS observation_commentaire,
|
|
|
22 |
CONCAT(_utf8'<?xml version="1.0" encoding="UTF-8"?>',
|
|
|
23 |
'<info>',
|
|
|
24 |
'<nom_num_nomenclatural>',i.num_nom_sel,'</nom_num_nomenclatural>',
|
|
|
25 |
'<nom_num_taxonomique>',i.num_taxon,'</nom_num_taxonomique>',
|
|
|
26 |
'<saisie_date_transmission>',i.transmission,'</saisie_date_transmission>',
|
|
|
27 |
'<saisie_date_creation>',i.date_creation,'</saisie_date_creation>',
|
|
|
28 |
'<lieu_commune_utm_secteur>',l.sector,'</lieu_commune_utm_secteur>',
|
|
|
29 |
'<ordre>',i.ordre,'</ordre>',
|
|
|
30 |
'<nom_ret>',i.nom_ret,'</nom_ret>',
|
|
|
31 |
'<num_nom_ret>',i.num_nom_ret,'</num_nom_ret>',
|
|
|
32 |
'<station>',i.station,'</station>',
|
|
|
33 |
'<milieu>',i.milieu,'</milieu>',
|
|
|
34 |
'<maj_name>',l.maj_name,'</maj_name>',
|
|
|
35 |
'<update_date>',l.update_date,'</update_date>',
|
|
|
36 |
'</info>') AS observation_information_complement,
|
|
|
37 |
i.date_modification AS saisie_date_modification,
|
|
|
38 |
i.date_creation AS saisie_date_creation
|
622 |
jpm |
39 |
FROM (cel_inventory AS i LEFT JOIN locations AS l ON (((i.location = l.name) AND (i.id_location = l.code))))
|
|
|
40 |
WHERE (i.transmission = 1);
|