CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • Subqueries and sql_calc_found_rows
Pages: [1]

Author Topic: Subqueries and sql_calc_found_rows  (Read 1157 times)

krypto

  • I post occasionally
  • **
  • Posts: 69
  • Karma: 5
  • IT guy for @bhahumanists. Running Civi on WP.
    • British Humanist Association
  • CiviCRM version: 4.5.8
  • CMS version: WordPress 4.x
  • MySQL version: 5.5.x
  • PHP version: 5.5.x
Subqueries and sql_calc_found_rows
February 08, 2014, 04:18:23 am
Just trying to create a report that displays a bunch of counts, and am hitting a problem with sql_calc_found_rows being added to select subqueries. If I try:

Code: [Select]
SELECT
    (SELECT
            count(ci.id)
        from
            civicrm_value_celebrant_info
            ) As CountOfIds

it becomes:

Code: [Select]
SELECT SQL_CALC_FOUND_ROWS
    (SELECT SQL_CALC_FOUND_ROWS
            count(ci.id)
        from
            civicrm_value_celebrant_info
            ) As CountOfIds

which throws an error. Is there a way to stop sql_calc_found_rows getting inserted? Or is there a better sql technique?

krypto

  • I post occasionally
  • **
  • Posts: 69
  • Karma: 5
  • IT guy for @bhahumanists. Running Civi on WP.
    • British Humanist Association
  • CiviCRM version: 4.5.8
  • CMS version: WordPress 4.x
  • MySQL version: 5.5.x
  • PHP version: 5.5.x
Re: Subqueries and sql_calc_found_rows
February 19, 2014, 04:41:29 am
FYI I 'fixed' this by stripping everything complex out of the report and just using a basic template as per Case 1 at http://wiki.civicrm.org/confluence/display/CRMDOC/CiviReport+Reference.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • Subqueries and sql_calc_found_rows

This forum was archived on 2017-11-26.