Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use guiagps2devdb;
- SELECT v.STR_VALOR nombre, COUNT(f.ID_VALOR) n, CONCAT('restaurantes/',u.TXT_NOMBRE_DEPARTAMENTO,'-',
- u.TXT_NOMBRE_PROVINCIA,'-',v.STR_VALOR,'-',IF(2>0,u.TXT_NOMBRE_DISTRITO,''),'?',
- 'cmbDepartamento=', 15 ,'&cmbProvincia=',5,'&itCo[]=',f.ID_VALOR,'&cmbDistrito[]=', IF(2>0,2,'')) AS ruta
- 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 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 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' ))
- AND u.ID_DEPARTAMENTO='15' AND u.ID_PROVINCIA='5' AND (IF(IFNULL(2, 0)>0, u.ID_DISTRITO =2, u.ID_PROVINCIA = '5' ))
- AND fi.ID_TIPO_SITE='2'
- GROUP BY f.ID_VALOR;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement