Okay
  Public Ticket #2535598
Amelia Report with WPDataTables
Closed

Comments

  •  1
    Gary started the conversation

    So I am trying to run a report with wpdatatables so I can look up all the customers and list their events and see the custom fields.  No matter what I do, it does not yield any results below is what I am using


    SELECT wp_amelia_events.`name`,
           wp_amelia_events.`name`,
           wp_amelia_events_periods.`periodStart`,
           wp_amelia_users.`firstName`,
           wp_amelia_users.`lastName`,
           wp_amelia_users.`email`,
           wp_amelia_users.`phone`,
           wp_amelia_users.`note`,
           wp_amelia_customer_bookings.`status`
           wp_amelia_customer_bookings.`customFields`

    FROM wp_amelia_events, wp_amelia_users
      LEFT JOIN wp_amelia_events_periods
         ON wp_amelia_events.`id` = wp_amelia_events_periods.`eventId`
         AND wp_amelia_customer_bookings_to_events_periods.`eventPeriodId` = wp_amelia_events_periods.`id`
      LEFT JOIN wp_amelia_customer_bookings_to_events_periods
         ON wp_amelia_events_periods.`id` = wp_amelia_customer_bookings_to_events_periods.`eventPeriodId`
         AND wp_amelia_customer_bookings.`id` = wp_amelia_customer_bookings_to_events_periods.`customerBookingId`
      LEFT JOIN wp_amelia_customer_bookings
         ON wp_amelia_users.`id` = wp_amelia_customer_bookings.`customerId`

     

  •  2,572
    Aleksandar replied

    Hello Gary

    When you modify the query, to exclude the duplicate wp_amelia_events.`name` and add a comma after wp_amelia_cutomer_bookings.`status`:

    SELECT wp_amelia_events.`name`,
           wp_amelia_events_periods.`periodStart`,
           wp_amelia_users.`firstName`,
           wp_amelia_users.`lastName`,
           wp_amelia_users.`email`,
           wp_amelia_users.`phone`,
           wp_amelia_users.`note`,
           wp_amelia_customer_bookings.`status`,
           wp_amelia_customer_bookings.`customFields`
    FROM wp_amelia_events, wp_amelia_users
      LEFT JOIN wp_amelia_events_periods
         ON wp_amelia_events.`id` = wp_amelia_events_periods.`eventId`
         AND wp_amelia_customer_bookings_to_events_periods.`eventPeriodId` = wp_amelia_events_periods.`id`
      LEFT JOIN wp_amelia_customer_bookings_to_events_periods
         ON wp_amelia_events_periods.`id` = wp_amelia_customer_bookings_to_events_periods.`eventPeriodId`
         AND wp_amelia_customer_bookings.`id` = wp_amelia_customer_bookings_to_events_periods.`customerBookingId`
      LEFT JOIN wp_amelia_customer_bookings
         ON wp_amelia_users.`id` = wp_amelia_customer_bookings.`customerId`

    The error that comes up is Unknown column 'wp_amelia_events.id' in 'on clause'

    Due to the MySQL manual, the precedence of the comma operator is less than that of INNER JOIN, CROSS JOIN, LEFT JOIN, and so on. If you mix comma joins with the other join types when there is a join condition, an error of the form Unknown column 'col_name' in 'on clause' may occur.

    You need to modify the query, and either include aliases, or modify the query so it doesn't contain commas. Writing custom queries is not included in the provided support for the plugin, so unfortunately I can't help you with this in any other way.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  1
    Gary replied

    that worked.  thank you

  •  2,572
    Aleksandar replied

    You're welcome, Gary

    If you have any further questions or issues, please feel free to open a new ticket, and we'll gladly help.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables