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 CiviMail (Moderator: Piotr Szotkowski) »
  • CiviMail to smart group based on emails can fail
Pages: [1]

Author Topic: CiviMail to smart group based on emails can fail  (Read 1020 times)

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
CiviMail to smart group based on emails can fail
October 22, 2008, 02:45:58 am
We have a smart group which is composed of contacts who match email like '%'

Attempting to send a mail to this smart group generates the following SQL error:

Code: [Select]
INSERT IGNORE INTO  I_1 (email_id, contact_id)
                    SELECT DISTINCT     civicrm_email.id as email_id,
                                        contact_a.id as contact_id
                     FROM civicrm_contact contact_a LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1)
                    LEFT JOIN           civicrm_email
                            ON          civicrm_email.contact_id = contact_a.id
                    LEFT JOIN           X_1
                            ON          contact_a.id = X_1.contact_id
                    WHERE           
                                        contact_a.do_not_email = 0
                        AND             contact_a.is_opt_out = 0
                        AND             (civicrm_email.is_bulkmail = 1 OR civicrm_email.is_primary = 1)
                        AND             civicrm_email.on_hold = 0
                                         AND ( contact_a.contact_type IN ('Individual') AND  ( LOWER(civicrm_email.email) LIKE '%%' ) )
                        AND             contact_a.id NOT IN (
                                          SELECT contact_id FROM civicrm_group_contact
                                          WHERE civicrm_group_contact.group_id = 387 AND civicrm_group_contact.status = 'Removed')
                        AND             X_1.contact_id IS null
                    ORDER BY civicrm_email.is_bulkmail

The SQL error is: ** Not unique table/alias: 'civicrm_email' (you'll see above that civicrm_email is joined twice in the query; the second reference seems redundant.

@xurizaemon ● www.fuzion.co.nz

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: CiviMail to smart group based on emails can fail
October 22, 2008, 11:09:27 am
Looks like a bug, can you file an issue for this.

Kurund
Found this reply helpful? Support CiviCRM

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • CiviMail to smart group based on emails can fail

This forum was archived on 2017-11-26.