Announcement

Collapse
No announcement yet.

ERROR: SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ERROR: SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias

    After migrating espo to latest Version 8.0.6, I encountered this error (ERROR: Process 659e67c05a4f6cb76 formula error: SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias) while running this formula:
    $idContactPR2f68a2=record\findRelatedMany('Partena riatRD',
    id,
    'leads',10,'createdAt','desc',
    'reportFilter61407c2b7dc93b179');

    Before the migration, everything is going well.​

    How can I fix this please ?

  • #2
    Hi,

    As the post doesn't conform the bug report rules, I moving it to another category.

    Comment


    • #3
      Hi,
      as you use Report (Advanced Pack) , what version is ?
      maybe

      Comment


      • #4
        Knowing the Advanced Pack version may be helpful.

        Comment


        • #5
          Originally posted by item View Post
          Hi,
          as you use Report (Advanced Pack) , what version is ?
          maybe
          Yes, i use the version 3.0.14 of Advanced Pack

          Comment


          • #6
            Originally posted by yuri View Post
            Knowing the Advanced Pack version may be helpful.
            version 3.0.14

            Comment


            • #7
              Good morning,
              I add some detail in relation to the feedback made by my colleague asellami,
              the formula is used in a node of a flowchart:​ Click image for larger version

Name:	Capture d’écran du 2024-01-10 13-18-02.png
Views:	488
Size:	97.7 KB
ID:	101465
              and when I add a log to display the sql query that is causing the problem I have this query :



              SELECT DISTINCT lead.id AS `id`, lead.created_at AS `createdAt` FROM `lead` AS `lead` JOIN `lead_partenariat` AS `partenariatsMiddle` ON lead.id = partenariatsMiddle.lead_id AND partenariatsMiddle.deleted = 0 JOIN `partenariat` AS `partenariats` ON partenariats.id = partenariatsMiddle.partenariat_id AND partenariats.deleted = 0 LEFT JOIN `historique_activite_p_r` AS `historiqueActivitePRs` ON lead.id = historiqueActivitePRs.lead_id AND historiqueActivitePRs.deleted = 0 LEFT JOIN `lead_partenariat` AS `partenariatsMiddle` ON lead.id = partenariatsMiddle.lead_id AND partenariatsMiddle.deleted = 0 LEFT JOIN `partenariat` AS `partenariats` ON partenariats.id = partenariatsMiddle.partenariat_id AND partenariats.deleted = 0 LEFT JOIN `partenariat_r_d_lead` AS `partenariatRDsMiddle` ON lead.id = partenariatRDsMiddle.lead_id AND partenariatRDsMiddle.deleted = 0 LEFT JOIN `partenariat_r_d` AS `partenariatRDs` ON partenariatRDs.id = partenariatRDsMiddle.partenariat_r_d_id AND partenariatRDs.deleted = 0 LEFT JOIN `entity_email_address` AS `emailAddressesMultipleMiddle` ON lead.id = emailAddressesMultipleMiddle.entity_id AND emailAddressesMultipleMiddle.deleted = 0 AND emailAddressesMultipleMiddle.entity_type = 'Lead' LEFT JOIN `email_address` AS `emailAddressesMultiple` ON emailAddressesMultiple.id = emailAddressesMultipleMiddle.email_address_id AND emailAddressesMultiple.deleted = 0 WHERE partenariats.id = '633c10b4c1ceb0c23' AND (((historiqueActivitePRs.name LIKE '2023%') OR (historiqueActivitePRs.name LIKE '2024%'))) AND (((historiqueActivitePRs.name LIKE '%partenariat%') OR (historiqueActivitePRs.name LIKE 'opfs%'))) AND (((partenariats.name = '2023') OR (partenariats.name = '2024') OR (partenariatRDs.name = '2023') OR (partenariatRDs.name = '2024'))) AND ((((emailAddressesMultiple.lower <> '')) AND ((emailAddressesMultiple.lower IS NOT NULL)))) AND lead.deleted = 0 ORDER BY lead.created_at DESC LIMIT 0, 10 ;

              ERROR 1066 (42000): Not unique table/alias: 'partenariatsMiddle'

              in which we see very clearly that there are two times the alias partnershipsMiddle.

              Comment


              • #9
                Thank you Yuri, I'm going to test this !

                Comment

                Working...
                X