Server side error 200: SQLSTATE[42000]

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Remish Dmytro
    Junior Member
    • Oct 2017
    • 1

    Server side error 200: SQLSTATE[42000]

    Hello. In a certain moment the system began showing an error:

    Server side error 200: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS `1Name`, oplata.1_id AS `1Id` FROM `oplata` LEFT JOIN `case` AS `case5` ON op' at line 1

    After analysing of MySQL queries I have found some mistakes. There is one example:

    SELECT oplata.id AS `id`, oplata.name AS `name`, oplata.deleted AS `deleted`, oplata.description AS `description`, oplata.created_at AS `createdAt`, oplata.modified_at AS `modifiedAt`, oplata.data AS `data`, oplata.nomer AS `nomer`, oplata.document AS `document`, oplata.suma AS `suma`, oplata.suma_currency AS `sumaCurrency`, oplata.created_by_id AS `createdById`, TRIM(CONCAT(createdBy.first_name, ' ', createdBy.last_name)) AS `createdByName`, oplata.modified_by_id AS `modifiedById`, TRIM(CONCAT(modifiedBy.first_name, ' ', modifiedBy.last_name)) AS `modifiedByName`, oplata.assigned_user_id AS `assignedUserId`, TRIM(CONCAT(assignedUser.first_name, ' ', assignedUser.last_name)) AS `assignedUserName`, oplata.contact3_id AS `contact3Id`, TRIM(CONCAT(contact3.first_name, ' ', contact3.last_name)) AS `contact3Name`, oplata.case4_id AS `case4Id`, case4.name AS `case4Name`, oplata.suma * suma_currency_alias.rate AS `sumaConverted`, oplata.case5_id AS `case5Id`, case5.name AS `case5Name`, 1.name AS `1Name`, oplata.1_id AS `1Id`
    FROM `oplata`
    LEFT JOIN `case` AS `case5` ON oplata.case5_id = case5.id
    LEFT JOIN `case` AS `case4` ON oplata.case4_id = case4.id
    LEFT JOIN `contact` AS `contact3` ON oplata.contact3_id = contact3.id
    LEFT JOIN `user` AS `assignedUser` ON oplata.assigned_user_id = assignedUser.id
    LEFT JOIN `user` AS `modifiedBy` ON oplata.modified_by_id = modifiedBy.id
    LEFT JOIN `user` AS `createdBy` ON oplata.created_by_id = createdBy.id

    LEFT JOIN `attachment` AS `1` ON oplata.1_id = 1.id
    LEFT JOIN currency AS `suma_currency_alias` ON suma_currency_alias.id = oplata.suma_currency
    WHERE oplata.case5_id = '59d490e02da25b38b' AND oplata.deleted = '0'


    As you can see there is a name error which concerns to LEFT JOIN `attachment` AS `1` table. Since a name can't be consisted of one number.

    So there is an evident question - how to correct this mistake?
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Hello Dmytro.

    What happened before the error occurred for the first time?
    What version of EspoCRM do you use?
    Could you share with me your 'custom' folder?

    Comment

    Working...