mysql -u root -ptoninho13 papedins_db -N -e 'select CONCAT("INSERT INTO enderecos_evidencias (id_evidencia, id_endereco_do_OSM, time_stamp) VALUES \n((select id_chave_evidencia from evidencias where nome_evidencia=\"", (select nome_evidencia from evidencias where id_chave_evidencia = id_evidencia),"\" and data=\"",(select data from evidencias where id_chave_evidencia=id_evidencia),"\"), (select id_chave_endereco_do_OSM from enderecos_do_OSM where osm_type = \"", COALESCE(select osm_type from enderecos_do_OSM where id_chave_endereco_do_OSM = id_endereco_do_OSM),"\" and osm_id = \"",COALESCE(select osm_id from enderecos_do_OSM where id_chave_endereco_do_OSM = id_endereco_do_OSM),"\" and class = \"",COALESCE(select class from enderecos_do_OSM where id_chave_endereco_do_OSM = id_endereco_do_OSM),"\"), \"", COALESCE(time_stamp,""), "\");\n\n") from enderecos_evidencias' -B | sed 's/\\n/\n/g'
