Title: Filter without using &#039;LIKE&#039;?
Last modified: August 31, 2016

---

# Filter without using 'LIKE'?

 *  [gb.wp](https://wordpress.org/support/users/gregburnison/)
 * (@gregburnison)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/filter-without-using-like/)
 * 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://wordpress.org/plugins/exports-and-reports/](https://wordpress.org/plugins/exports-and-reports/)

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

 * ![](https://s.w.org/plugins/geopattern-icon/exports-and-reports.svg)
 * [Exports and Reports](https://wordpress.org/plugins/exports-and-reports/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/exports-and-reports/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/exports-and-reports/)
 * [Active Topics](https://wordpress.org/support/plugin/exports-and-reports/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/exports-and-reports/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/exports-and-reports/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [gb.wp](https://wordpress.org/support/users/gregburnison/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/filter-without-using-like/)
 * Status: not resolved