diff --git a/src/libs/routes/idhme.js b/src/libs/routes/idhme.js
index ac52c5d48582823b0eb5591dfefd7135052e3f01..d762c95d7b2c6eb59478b2c49af54d4b712957c0 100644
--- a/src/libs/routes/idhme.js
+++ b/src/libs/routes/idhme.js
@@ -90,12 +90,12 @@ rqf.addField({
         relation: '=',
         type: 'integer',
         field: 'estado_id',
-        table: 'adh_idh_uf'
+        table: '@'
     },
     join: {
         primary: 'id',
         foreign: 'estado_id',
-        foreignTable: 'adh_idh_uf'
+        foreignTable: '@'
     }
 });
 
@@ -107,22 +107,24 @@ idhmeApp.get('/', rqf.parse(), (req, res, next) => {
             message: 'Wrong/No filter specified'
         });
     }
-    if ("state" in req.filter) {
-        // console.log("sim");
-        req.sql.from('adh_idh_uf')
-        .field('adh_idh_uf.idhm_e', 'total')
-        .field('adh_idh_uf.ano_censo', 'year')
-        .field('adh_idh_uf.estado_id', 'state_id');
-    } else if ("city" in req.filter) {
+
+    if (!("state" in req.filter) && !("city" in req.filter)) {
+        next({
+            status: 400,
+            message: 'Wrong/No filter specified'
+        });
+    }
+    if ("city" in req.filter) {
         req.sql.from('adh_idh')
         .field('adh_idh.idhm_e', 'total')
         .field('adh_idh.ano_censo', 'year')
         .field('adh_idh.municipio_id', 'city_id');
     } else {
-        next({
-            status: 400,
-            message: 'Wrong/No filter specified'
-        });
+        // console.log("sim");
+        req.sql.from('adh_idh_uf')
+        .field('adh_idh_uf.idhm_e', 'total')
+        .field('adh_idh_uf.ano_censo', 'year')
+        .field('adh_idh_uf.estado_id', 'state_id');
     }
     next();
 }, rqf.build(), query, response('idhme'));
diff --git a/src/libs/routes/idhml.js b/src/libs/routes/idhml.js
index fed978c8795f33af4e7eb9679a3d663c9c2d0617..81b920cdaefd83a7ab0a72f438c7d022f311c2e1 100644
--- a/src/libs/routes/idhml.js
+++ b/src/libs/routes/idhml.js
@@ -90,12 +90,12 @@ rqf.addField({
         relation: '=',
         type: 'integer',
         field: 'estado_id',
-        table: 'adh_idh_uf'
+        table: '@'
     },
     join: {
         primary: 'id',
         foreign: 'estado_id',
-        foreignTable: 'adh_idh_uf'
+        foreignTable: '@'
     }
 });
 
@@ -107,21 +107,23 @@ idhmlApp.get('/', rqf.parse(), (req, res, next) => {
             message: 'Wrong/No filter specified'
         });
     }
-    if ("state" in req.filter) {
-        req.sql.from('adh_idh_uf')
-        .field('adh_idh_uf.idhm_l', 'total')
-        .field('adh_idh_uf.ano_censo', 'year')
-        .field('adh_idh_uf.estado_id', 'state_id');
-    } else if ("city" in req.filter) {
+    if (!("state" in req.filter) && !("city" in req.filter)) {
+        next({
+            status: 400,
+            message: 'Wrong/No filter specified'
+        });
+    }
+    if ("city" in req.filter) {
         req.sql.from('adh_idh')
         .field('adh_idh.idhm_l', 'total')
         .field('adh_idh.ano_censo', 'year')
         .field('adh_idh.municipio_id', 'city_id');
     } else {
-        next({
-            status: 400,
-            message: 'Wrong/No filter specified'
-        });
+        // console.log("sim");
+        req.sql.from('adh_idh_uf')
+        .field('adh_idh_uf.idhm_l', 'total')
+        .field('adh_idh_uf.ano_censo', 'year')
+        .field('adh_idh_uf.estado_id', 'state_id');
     }
     next();
 }, rqf.build(), query, response('idhml'));