# Commparaison des vues del_images et v_del_images
ALTER ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_del_image` AS 
select 
	`o`.`id_observation` AS `id_observation`,
	`o`.`ordre` AS `ordre`,
	`o`.`ce_utilisateur` AS `ce_utilisateur`,
	`o`.`prenom_utilisateur` AS `prenom_utilisateur`,
	`o`.`nom_utilisateur` AS `nom_utilisateur`,
	`o`.`courriel_utilisateur` AS `courriel_utilisateur`,
	`o`.`nom_sel` AS `nom_sel`,
	`o`.`nom_sel_nn` AS `nom_sel_nn`,
	`o`.`nom_ret` AS `nom_ret`,
	`o`.`nom_ret_nn` AS `nom_ret_nn`,
	`o`.`nt` AS `nt`,
	`o`.`famille` AS `famille`,
	`o`.`nom_referentiel` AS `nom_referentiel`,
	`o`.`ce_zone_geo` AS `ce_zone_geo`,
	`o`.`zone_geo` AS `zone_geo`,
	`o`.`lieudit` AS `lieudit`,
	`o`.`station` AS `station`,
	`o`.`milieu` AS `milieu`,
	`o`.`latitude` AS `latitude`,
	`o`.`longitude` AS `longitude`,
	`o`.`altitude` AS `altitude`,
	`o`.`geodatum` AS `geodatum`,
	`o`.`date_observation` AS `date_observation`,
	`o`.`mots_cles_texte` AS `mots_cles_texte`,
	`o`.`commentaire` AS `commentaire`,
	`o`.`transmission` AS `transmission`,
	`o`.`date_creation` AS `date_creation`,
	`o`.`date_modification` AS `date_modification`,
	`o`.`date_transmission` AS `date_transmission`,
	`o`.`abondance` AS `abondance`,
	`o`.`certitude` AS `certitude`,
	`o`.`phenologie` AS `phenologie`,
	`o`.`code_insee_calcule` AS `code_insee_calcule`,
	`i`.`id_image` AS `id_image`,
	`i`.`ordre` AS `i_ordre`,
	`i`.`ce_utilisateur` AS `i_ce_utilisateur`,
	`i`.`prenom_utilisateur` AS `i_prenom_utilisateur`,
	`i`.`nom_utilisateur` AS `i_nom_utilisateur`,
	`i`.`courriel_utilisateur` AS `i_courriel_utilisateur`,
	`i`.`hauteur` AS `hauteur`,
	`i`.`largeur` AS `largeur`,
	`i`.`date_prise_de_vue` AS `date_prise_de_vue`,
	`i`.`mots_cles_texte` AS `i_mots_cles_texte`,
	`i`.`commentaire` AS `i_commentaire`,
	`i`.`nom_original` AS `nom_original`,
	`i`.`publiable_eflore` AS `publiable_eflore` 
from 
		`tb_cel`.`cel_obs` `o` 
		JOIN `tb_cel`.`cel_obs_images` `oi` ON `oi`.`id_observation` = `o`.`id_observation`
		JOIN `tb_cel`.`cel_images` `i` ON `i`.`id_image` = `oi`.`id_image`
WHERE `o`.`transmission` = '1';

ALTER ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `del_image` AS 
select 
	`i`.`id_image` AS `id_image`,
	if((char_length(`i`.`ce_utilisateur`) <> 32), cast(`i`.`ce_utilisateur` AS unsigned), 0) AS `ce_utilisateur`,
	`i`.`prenom_utilisateur` AS `prenom_utilisateur`,
	`i`.`nom_utilisateur` AS `nom_utilisateur`,
	`i`.`courriel_utilisateur` AS `courriel_utilisateur`,
	`i`.`hauteur` AS `hauteur`,
	`i`.`largeur` AS `largeur`,
	`i`.`date_prise_de_vue` AS `date_prise_de_vue`,
	`i`.`mots_cles_texte` AS `mots_cles_texte`,
	`i`.`commentaire` AS `commentaire`,
	`i`.`nom_original` AS `nom_original`,
	`i`.`date_modification` AS `date_modification`,
	`i`.`date_creation` AS `date_creation`,
	`i`.`publiable_eflore` AS `publiable_eflore`,
	`o`.`nom_referentiel` AS `nom_referentiel`
from 
	`tb_cel`.`cel_images` `i` 
	JOIN `tb_cel`.`cel_obs_images` `oi` ON `i`.`id_image` = `oi`.`id_image`
	JOIN `tb_cel`.`cel_obs` `o` ON `oi`.`id_observation` = `o`.`id_observation`
where `o`.`transmission` = '1'
