const search = req.query.search ? `concat_ws(city.city,state.state,country.country) LIKE '%${req.query.search}%' AND ` : ""const sqlQuery = `SELECT * FROM city JOIN state ON city.state_id = state.state_id JOIN country ON state.country_id = country.country_id WHERE ${search} city.status = 'true' `; db.query(sqlQuery, function (err, results1, fields) {if (err) {console.log(err)}else {res.status(200).json({issuccess: true,status: 200,massage: "Successfully Save",Data: results1,});}
When I hit this route with search query and true value via postman. it is working properly. but when I query with wrong value , it keeps running . does not throw any error neither any results.