Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT cast(v.STR_VALOR as char character set utf8) as nombre,
- COUNT(distinct ce.txt_rznsoc_nombre) as n,
- CAST(
- CONCAT(v.STR_VALOR,'|',u.TXT_NOMBRE_DEPARTAMENTO,'|',
- u.TXT_NOMBRE_PROVINCIA,'|',
- IF(2>0,u.TXT_NOMBRE_DISTRITO,''),'?',
- '|', u.ID_DEPARTAMENTO ,
- '|',u.ID_PROVINCIA,
- '|',f.ID_VALOR,
- '|', IF(2>0,u.ID_DISTRITO,'')
- )AS CHAR CHARACTER SET utf8) AS routeparam
- FROM cnf_valor v
- INNER JOIN fic_rest_param f ON v.ID_VALOR = f.ID_VALOR
- INNER JOIN fic_ficha_ente fi ON f.ID_FICHA = fi.ID_FICHA
- INNER JOIN cnf_ente as ce ON ce.id_ente = fi.id_ente
- INNER JOIN fic_rest_ficha res ON f.ID_FICHA = res.ID_FICHA AND f.ID_REST_FICHA = res.ID_REST_FICHA
- INNER JOIN fic_ubigeo u ON res.ID_UBIGEO_DE = u.ID_DEPARTAMENTO AND res.ID_UBIGEO_PR = u.ID_PROVINCIA
- AND res.ID_UBIGEO_DI = u.ID_DISTRITO
- WHERE v.ID_PARAMETRO='22' AND f.ID_VALOR IN (19, 277, 280, 288, 291, 295, 297, 315, 1017, 1021)
- AND fi.ID_ESTADO='6' AND fi.ID_FICHA_EDITADA=0
- AND u.ID_DEPARTAMENTO='15' AND u.ID_PROVINCIA='1'
- AND fi.ID_TIPO_SITE='2'
- GROUP BY f.ID_VALOR;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement