Menu

SQL Error: 1054

2009-02-02
2013-05-29
  • Nobody/Anonymous

    Hallo Forum,

    ich habe Tellmatic frisch installiert und alles scheint soweit zu funktionieren, bis ich beim Versand eines NL eine große Fehlerseite erhalte mit der Überschrift

    SQL Error: 1054 (Unknown column 'nl_q.nl_id' in 'on clause')

    und desweiteren:

    Invalid SQL:
                /* insert new adr_id for selected newsletter in newsletter history */
                /* adresses can refer to multiple groups adr_grp.id via adr_grp_ref.adr_id and adr_grp_ref.grp_id (inner join) */
                INSERT INTO
                    nl_h
                    (
                        q_id, #qeue id
                        #1 AS q_id,
                        host_id, #host id
                        #1 AS host_id,
                        nl_id, #newsletter id
                        #1 AS nl_id,
                        grp_id, #adress group id
                        adr_id, #adress id
                        status, #history status (1=new)
                        created, #creation date
                        sent, #send date
                        siteid #the siteid
                    )
                SELECT
                    /* we also could use prefined values from php array h, but we use matches */
                    /* q_id, host_id from q, nl_id from nl.id, adr_id from adr.id, and grp_id from grp.id */
                    /* status, created is taken from array, sent is empty (not sent yet) and siteid as defined in Tellmatic */
                    nl_q.id AS q_id,
                    nl_q.host_id AS host_id,
                    nl.id AS nl_id,
                    adr_grp.id AS grp_id,
                    adr.id AS adr_id,
                    1 AS status,
                    '2009-02-02 03:44:07' AS created,
                    '' as sent,
                    'tellmatic' as siteid
                FROM adr
                    /* join adresstable adr.id with groups references table adr_grp_ref.adr_id */
                    INNER JOIN adr_grp_ref
                        ON adr.id = adr_grp_ref.adr_id
                    /* join groupstable adr_grp.id with groups references table adr_grp_ref.grp_id  */
                    INNER JOIN adr_grp
                        ON adr_grp_ref.grp_id = adr_grp.id
                    /* join newsletter nl.id with queuetable nl_q.nl_id */
                    INNER JOIN nl
                        ON nl_q.nl_id = nl.id
                    /* join newsletterqueue nl_q.grp_id with groupstable adr_grp.id */
                    INNER JOIN nl_q
                        ON adr_grp.id = nl_q.grp_id
                    /* left join now adresstable adr.id with temporary historytable/recipientstable nl_h_tmp_tellmatic_1_1_1_603.adr_id */
                    LEFT JOIN nl_h_tmp_tellmatic_1_1_1_603 ON adr.id = nl_h_tmp_tellmatic_1_1_1_603.adr_id
                WHERE
                    /* Address is active */
                    adr.aktiv=1
                    /* for siteid */
                    AND adr.siteid='tellmatic'
                    AND (
                                /* less errors */
                                adr.errors<=5
                                /* or NULL */
                                OR adr.errors IS NULL
                            )
                    AND (
                                /* filter adr with status */
                                 adr.status=1
                                OR adr.status=2
                                OR adr.status=3
                                OR adr.status=4
                                OR adr.status=10
                                OR adr.status=12
                            )
                    /* for selected group */
                    AND adr_grp.id=1
                    AND adr_grp_ref.grp_id=1
                    AND nl_q.grp_id=1
                    AND (
                            /* q status must be 1 new or 2 started */
                            nl_q.status=1
                            OR nl_q.status=2
                            )
                    /* group must be active */
                    AND adr_grp.aktiv=1
                    /* for selected newsletter */
                    AND nl.id=1
                    AND nl_q.nl_id=1
                    /* for siteid */
                    AND adr_grp.siteid='tellmatic'
                    AND adr_grp_ref.siteid='tellmatic'
                    AND nl.siteid='tellmatic'
                    AND nl_q.siteid='tellmatic'
                    AND
                    /* only addresses not included in temporary table */
                    nl_h_tmp_tellmatic_1_1_1_603.adr_id IS NULL
                   

    Zur Zeit gibt es keine zu verarbeitenden Versandaufträge.
    Die Seite wird in 300 Sekunden automatisch neu geladen.
    Klicken Sie auf 'Neu laden' wenn Sie diese Seite erneut aufrufen wollen.
    Neu laden

    2009-02-02 03:44:07: Preparing 1 of 1 Qs
    begin

    2009-02-02 03:44:07: QID=1
    2009-02-02 03:44:07: Status=1
    2009-02-02 03:44:07: nl_id=1
    2009-02-02 03:44:07: grp_id=1
    2009-02-02 03:44:07: host_id=1
    2009-02-02 03:44:07: send_at=2009-02-02 03:33:00
    2009-02-02 03:44:07: autogen=1
    2009-02-02 03:44:07: q status=1, q autogen =1, creating recipients list:
    2009-02-02 03:44:07:     Error refreshing recipients list!
    2009-02-02 03:44:07: q status =1, new status=2, sending mail to admin

    Was ist hier falsch / was zu tun?

    Viele Grüße -
    christian

     
    • Nobody/Anonymous

      Hi,

      gerade gestern habe ich hier gepostet, da ich den gleichen Fehler habe!
      Siehe hier (allerdings auf englisch):
      http://sourceforge.net/forum/forum.php?thread_id=2958611&forum_id=675746

      Momentan gibt es dafür leider keine Erklärung laut "vizzy", da der Fehler nicht reproduzierbar ist und der Eintrag in der Tabelle vorhanden ist etc.

      Evtl. kann man ja die Threads zusammenführen bzw. nur noch in einem posten.

      Bei welchem Hoster bist Du denn, da man so evtl. das Problem eingrenzen könnte?

       
    • vizzy

      vizzy - 2009-02-02

      Hi,

      ich hab es nun geschafft das Problem nachzuvollziehen.
      Es trat bei mir nicht auf da es mit den MySQL Versionen zusammenhaengt.
      Seit einer bestimmten MySQL5 Version hat sich im Bezug auf Joins und On Clauses etwas geaendert.

      Das Problem laesst sich umgehen in dem man in der Datei include/Class_Q.inc.php ab Zeile 710 die Zeilen:

        710             FROM ".TM_TABLE_ADR."
        711                 /* join adresstable adr.id with groups references table adr_grp_ref.adr_id */
        712                 INNER JOIN ".TM_TABLE_ADR_GRP_REF."
        713                     ON ".TM_TABLE_ADR.".id = ".TM_TABLE_ADR_GRP_REF.".adr_id
        714                 /* join groupstable adr_grp.id with groups references table adr_grp_ref.grp_id  */
        715                 INNER JOIN ".TM_TABLE_ADR_GRP."
        716                     ON ".TM_TABLE_ADR_GRP_REF.".grp_id = ".TM_TABLE_ADR_GRP.".id
        717                 /* join newsletter nl.id with queuetable nl_q.nl_id */
        718                 INNER JOIN ".TM_TABLE_NL."
        719                     ON ".TM_TABLE_NL_Q.".nl_id = ".TM_TABLE_NL.".id
        720                 /* join newsletterqueue nl_q.grp_id with groupstable adr_grp.id */
        721                 INNER JOIN ".TM_TABLE_NL_Q."
        722                     ON ".TM_TABLE_ADR_GRP.".id = ".TM_TABLE_NL_Q.".grp_id
        723                 /* left join now adresstable adr.id with temporary historytable/recipientstable $tmp_tablename.adr_id */
        724                 LEFT JOIN ".$tmp_tablename." ON ".TM_TABLE_ADR.".id = ".$tmp_tablename.".adr_id

      ändert in

        710             FROM (".TM_TABLE_ADR.")
        711                 /* join adresstable adr.id with groups references table adr_grp_ref.adr_id */
        712                 INNER JOIN ".TM_TABLE_ADR_GRP_REF."
        713                     ON (".TM_TABLE_ADR.".id = ".TM_TABLE_ADR_GRP_REF.".adr_id)
        714                 /* join groupstable adr_grp.id with groups references table adr_grp_ref.grp_id  */
        715                 INNER JOIN ".TM_TABLE_ADR_GRP."
        716                     ON (".TM_TABLE_ADR_GRP_REF.".grp_id = ".TM_TABLE_ADR_GRP.".id)

        720                 /* join newsletterqueue nl_q.grp_id with groupstable adr_grp.id */
        721                 INNER JOIN ".TM_TABLE_NL_Q."
        722                     ON (".TM_TABLE_ADR_GRP.".id = ".TM_TABLE_NL_Q.".grp_id)

        717                 /* join newsletter nl.id with queuetable nl_q.nl_id */
        718                 INNER JOIN ".TM_TABLE_NL."
        719                     ON (".TM_TABLE_NL_Q.".nl_id = ".TM_TABLE_NL.".id)
        723                 /* left join now adresstable adr.id with temporary historytable/recipientstable $tmp_tablename.adr_id */
        724                 LEFT JOIN ".$tmp_tablename." ON ".TM_TABLE_ADR.".id = ".$tmp_tablename.".adr_id

      es wurden Klammern gesetzt und die Zeilen 720-722 vor Zeile 717 verschoben!

      dann sollte es auch mit MySQL 5 ab bestimmten Versionen klappern.

      Details hier:
      http://dev.mysql.com/doc/refman/5.0/en/join.html

      Mir steht leider fuer die Entwicklung und Tests dauerhaft nur ein PHP4 System mit MySQL4 zur Verfuegung.
      Hoffe das wird sich aendern und TM zieh auf einen neuen Server.

      v.

       
      • Nobody/Anonymous

        Bei mir hat diese Lösung auch prima funktioniert, danke!

         
    • C h

      C h - 2009-02-02

      Perfekt! Vielen Dank für die schnelle Hilfe! Hat so jetzt funktioniert!

      Gruß -
      ch

       

Log in to post a comment.