Advertisement
slovacus

script de consulta para guiagps

Mar 20th, 2012
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.12 KB | None | 0 0
  1. use guiagps2devdb;
  2.  
  3. SELECT v.STR_VALOR nombre, COUNT(f.ID_VALOR) n, CONCAT('restaurantes/',u.TXT_NOMBRE_DEPARTAMENTO,'-',
  4.  u.TXT_NOMBRE_PROVINCIA,'-',v.STR_VALOR,'-',IF(2>0,u.TXT_NOMBRE_DISTRITO,''),'?',
  5.   'cmbDepartamento=', 15 ,'&cmbProvincia=',5,'&itCo[]=',f.ID_VALOR,'&cmbDistrito[]=', IF(2>0,2,'')) AS ruta
  6.   FROM cnf_valor v
  7.   INNER JOIN fic_rest_param f ON v.ID_VALOR = f.ID_VALOR
  8.   INNER JOIN fic_ficha_ente fi ON f.ID_FICHA = fi.ID_FICHA
  9.   INNER JOIN fic_rest_ficha res ON f.ID_FICHA = res.ID_FICHA AND f.ID_REST_FICHA = res.ID_REST_FICHA
  10.   INNER JOIN fic_ubigeo u ON res.ID_UBIGEO_DE = u.ID_DEPARTAMENTO AND res.ID_UBIGEO_PR = u.ID_PROVINCIA
  11.   AND res.ID_UBIGEO_DI = u.ID_DISTRITO
  12.  WHERE v.ID_PARAMETRO='22' AND f.ID_VALOR IN (19, 277, 280, 288, 291, 295, 297, 315, 1017, 1021)
  13.  AND fi.ID_ESTADO='6' AND fi.ID_FICHA_EDITADA=0
  14.  AND res.ID_UBIGEO_DE = '15' AND res.ID_UBIGEO_PR = '5' AND (IF(IFNULL(2, 0)>0, res.ID_UBIGEO_DI = 2, res.ID_UBIGEO_PR = '5' ))
  15.  AND u.ID_DEPARTAMENTO='15' AND u.ID_PROVINCIA='5' AND (IF(IFNULL(2, 0)>0, u.ID_DISTRITO =2, u.ID_PROVINCIA = '5' ))
  16.  AND fi.ID_TIPO_SITE='2'
  17.  GROUP BY f.ID_VALOR;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement