• gb.wp

    (@gregburnison)


    Is it possible to have a filter that doesn’t rely on LIKE as a comparison? I have a query on the usermeta table and would like to filter by the user_id.

    Starting simply to make sure things work…

    SELECT um.user_id, um.meta_key, um.meta_value
    FROM  wp_usermeta as um
    WHERE %%WHERE%% 1=1
    LIMIT %%LIMIT%%;

    I had to add the “1=1” because the %%WHERE%% was adding an “AND” at the end.

    When running the query (and filtering on user_id: 2) with debug I see this as the WHERE:

    WHERE (um.user_id LIKE '%2%') AND 1=1

    Is there a way to just have um.user_id = 2? A list of all the user_ids which contain a 2 isn’t what I’m after. ??

    Thanks

    https://www.ads-software.com/plugins/exports-and-reports/

  • The topic ‘Filter without using 'LIKE'?’ is closed to new replies.