'How to apply like when selecting row based on column which is not present in another table (Mysql Nodejs)

Hi Developers! I need your help

What I am doing right now is selecting only those rows based on column values that are not present in another table

Now what I want is after selecting those rows I want to apply like operator on them

My nameFilter

let nameFilter = "";
if (filters.search) {
        nameFilter = `AND wci.nfc_uid LIKE '%${nameFilter}%'`;
    }

MY Query

mysqlResult = await db.query(`SELECT * FROM wallet_card_inventory as wci WHERE NOT EXISTS 
    (SELECT cuw.nfc_uid FROM commuter_users_wallet as cuw WHERE wci.nfc_uid = cuw.nfc_uid) ${nameFilter} LIMIT ?,?`, [((page - 1) * perPage), perPage]);

Query works fine but it don't filter when I want to search something from Frontend



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source