Title: SELECT [DISTINCT] SQL_CALC_FOUND_ROWS
Last modified: September 23, 2020

---

# SELECT [DISTINCT] SQL_CALC_FOUND_ROWS

 *  [reverendcatch](https://wordpress.org/support/users/reverendcatch/)
 * (@reverendcatch)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/select-distinct-sql_calc_found_rows/)
 * Any reason you don’t grep for valid sql between SELECT and SQL_CALC_FOUND_ROWS(
   line 847 in v1.7)?
 * I modified my install of v1.7 to this to overcome issues with plugins that happen
   to select distinct sql_calc_found_rows from this:
 * if ( preg_match(‘/^\s*SELECT\s+SQL_CALC_FOUND_ROWS\s/i’, $query) ) {
 * to this:
 * if ( preg_match(‘/^\s*SELECT.*?\s+SQL_CALC_FOUND_ROWS\s/i’, $query) ) {
 * Not sure if there’s big implications for that but I don’t see why not ? You could
   put any other sort of flags or statements in there for a normal select. Seems
   arbitrary not to allow for it, unless I am mistaken? (it happens a lot 😛 )

The topic ‘SELECT [DISTINCT] SQL_CALC_FOUND_ROWS’ is closed to new replies.

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

 * 0 replies
 * 1 participant
 * Last reply from: [reverendcatch](https://wordpress.org/support/users/reverendcatch/)
 * Last activity: [5 years, 6 months ago](https://wordpress.org/support/topic/select-distinct-sql_calc_found_rows/)
 * Status: not resolved