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) »
  • LYBUNT Report crashes with "Subquery returns more than 1 row" Error 1242
Pages: [1]

Author Topic: LYBUNT Report crashes with "Subquery returns more than 1 row" Error 1242  (Read 1905 times)

BE55Roberts

  • Guest
LYBUNT Report crashes with "Subquery returns more than 1 row" Error 1242
June 02, 2010, 06:28:31 am
When I run the LYBUNT Report, the Preview screen crashes with a DB Error 1242, which reads as follows:

    Sorry. A non-recoverable error has occurred.

    DB Error: a515ac9c2796ca0e23adbe92c68fc9fc

    Database Error Code: Subquery returns more than 1 row, 1242

The only option is to return to the home page. The SQL Statement in error appears below:
    [debug_info] =>
SELECT SQL_CALC_FOUND_ROWS contact_civireport.id as cid
        FROM  civicrm_contribution  contribution_civireport
              INNER JOIN civicrm_contact contact_civireport
                      ON contact_civireport.id = contribution_civireport.contact_id
             
              LEFT  JOIN civicrm_email  email_civireport
                      ON contact_civireport.id = email_civireport.contact_id AND
                         email_civireport.is_primary = 1
              LEFT  JOIN civicrm_phone  phone_civireport
                      ON contact_civireport.id = phone_civireport.contact_id AND
                         phone_civireport.is_primary = 1  WHERE contribution_civireport.is_test = 0  AND contribution_civireport.contact_id NOT IN
((SELECT distinct contri.contact_id FROM civicrm_contribution contri
 WHERE   YEAR(contri.receive_date) =  2009 AND contri.is_test = 0) ) AND contribution_civireport.contact_id IN ((SELECT distinct contri.contact_id FROM civicrm_contribution contri
 WHERE   YEAR(contri.receive_date) =  (2009-1) AND contri.is_test = 0) )  AND ( contribution_civireport.contribution_status_id IN (1) )  GROUP BY contact_civireport.id  LIMIT 0, 50

--> [nativecode=1242 ** Subquery returns more than 1 row]




BE55Roberts

  • Guest
Re: LYBUNT Report crashes with "Subquery returns more than 1 row" Error 1242
June 02, 2010, 06:36:47 am
Further analysis shows that this is a SQL syntax issue:  :)

Specifically, there are double left parentheses around the subqueries. MySql 5.0 does not like that syntax. I changed line 133 in the Lybunt.php file to resolve it. That line now reads:

                                          'clause'  => "contribution_civireport.contact_id NOT IN
(SELECT distinct contri.contact_id FROM civicrm_contribution contri
 WHERE   YEAR(contri.receive_date) =  \$value AND contri.is_test = 0 ) AND contribution_civireport.contact_id IN
 (SELECT distinct contri.contact_id FROM civicrm_contribution contri
 WHERE   YEAR(contri.receive_date) =  (\$value-1) AND contri.is_test = 0 ) "

Note the Single Parentheses, which is correct. Attached is the revised file for Drupal 6.16 version of CiviCRM 3.1.5.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • LYBUNT Report crashes with "Subquery returns more than 1 row" Error 1242

This forum was archived on 2017-11-26.