Omar_one wrote: ↑Sun Jul 28, 2024 12:55 pmyou need to
No, already tried variations of that, it does not work.
Omar_one wrote: ↑Sun Jul 28, 2024 12:55 pmyou need to
I am not sure why the columns they are different on the file then database
You'll see why in the SQL that is output. Did quite a lot of debugging trying to get something to work, for example:
Code: Select all
$customers_sql = $customer_data->add_order_by($customers_sql, ['date_last_logon' => 'DESC']);
gives:
Code: Select all
SQL Query: SELECT ci.*, co.*, ab.*, c.*, c.customers_id AS id, c.customers_firstname AS firstname, c.customers_lastname AS lastname, c.customers_email_address AS email_address, ab.entry_country_id AS country_id, ci.customers_info_date_account_created AS date_account_created, ci.customers_info_date_account_last_modified AS date_account_last_modified, ci.customers_info_date_of_last_logon AS date_last_logon, ci.customers_info_number_of_logons AS number_of_logons FROM customers c LEFT JOIN address_book ab ON c.customers_id = ab.customers_id AND c.customers_default_address_id = ab.address_book_id LEFT JOIN countries co ON ab.entry_country_id = co.countries_id INNER JOIN customers_info ci ON c.customers_id = ci.customers_info_id ORDER BY ci.customers_info_date_account_created DESC
Note
ORDER BY ci.customers_info_date_account_created DESC at the end.
Your example gives:
Code: Select all
SQL Query: SELECT ci.*, co.*, ab.*, c.*, c.customers_id AS id, c.customers_firstname AS firstname, c.customers_lastname AS lastname, c.customers_email_address AS email_address, ab.entry_country_id AS country_id, ci.customers_info_date_account_created AS date_account_created, ci.customers_info_date_account_last_modified AS date_account_last_modified, ci.customers_info_date_of_last_logon AS date_last_logon, ci.customers_info_number_of_logons AS number_of_logons FROM customers c LEFT JOIN address_book ab ON c.customers_id = ab.customers_id AND c.customers_default_address_id = ab.address_book_id LEFT JOIN countries co ON ab.entry_country_id = co.countries_id INNER JOIN customers_info ci ON c.customers_id = ci.customers_info_id ORDER BY c.customers_id
Note
ORDER BY c.customers_id at the end, even the DESC doesn't work with that.
My question is more, "why does 'date_last_logon' give unexpected and incorrect result?"