Advertisement
slovacus

consulta de guia gps

Apr 3rd, 2012
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.16 KB | None | 0 0
  1. SELECT cast(v.STR_VALOR as char character set utf8) as nombre,
  2.         COUNT(distinct ce.txt_rznsoc_nombre) as n,
  3.         CAST(
  4.             CONCAT(v.STR_VALOR,'|',u.TXT_NOMBRE_DEPARTAMENTO,'|',
  5.             u.TXT_NOMBRE_PROVINCIA,'|',
  6.             IF(2>0,u.TXT_NOMBRE_DISTRITO,''),'?',
  7.             '|', u.ID_DEPARTAMENTO ,
  8.             '|',u.ID_PROVINCIA,
  9.             '|',f.ID_VALOR,
  10.             '|', IF(2>0,u.ID_DISTRITO,'')
  11.             )AS CHAR CHARACTER SET utf8) AS routeparam
  12.   FROM cnf_valor v
  13.   INNER JOIN fic_rest_param f ON v.ID_VALOR = f.ID_VALOR
  14.   INNER JOIN fic_ficha_ente fi ON f.ID_FICHA = fi.ID_FICHA
  15.   INNER JOIN cnf_ente as ce ON ce.id_ente = fi.id_ente
  16.   INNER JOIN fic_rest_ficha res ON f.ID_FICHA = res.ID_FICHA AND f.ID_REST_FICHA = res.ID_REST_FICHA
  17.   INNER JOIN fic_ubigeo u ON res.ID_UBIGEO_DE = u.ID_DEPARTAMENTO AND res.ID_UBIGEO_PR = u.ID_PROVINCIA
  18.   AND res.ID_UBIGEO_DI = u.ID_DISTRITO
  19.  WHERE v.ID_PARAMETRO='22' AND f.ID_VALOR IN (19, 277, 280, 288, 291, 295, 297, 315, 1017, 1021)
  20.     AND fi.ID_ESTADO='6' AND fi.ID_FICHA_EDITADA=0
  21.     AND u.ID_DEPARTAMENTO='15' AND u.ID_PROVINCIA='1'
  22.  AND fi.ID_TIPO_SITE='2'
  23.  GROUP BY f.ID_VALOR;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement