PDA

View Full Version : All Customers Report



michael_s
07-17-2007, 08:30 AM
We had some problems with the original JOINs in the query in MySQL 5 so below is an updated SQL statement to replace the one around line 117 which does the same, but works on all MySQL versions we tested.

Regards

$customers_query_raw = "SELECT c.customers_id , c.customers_default_address_id, c.customers_email_address, c.customers_dob, c.customers_telephone, c.customers_gender, c.hear, a.entry_company, a.address_book_id, a.customers_id, a.entry_firstname, a.entry_lastname, a.entry_street_address, a.entry_suburb, a.entry_city, a.entry_state, a.entry_postcode, a.entry_country_id, a.entry_zone_id, z.zone_code, co.countries_name FROM " . TABLE_CUSTOMERS . " c LEFT JOIN " . TABLE_ADDRESS_BOOK . " a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id JOIN " . TABLE_COUNTRIES . " co ON a.entry_country_id = co.countries_id LEFT JOIN " . TABLE_ZONES . " z ON a.entry_zone_id = z.zone_id ORDER BY $db_orderby $sorted";


More... (http://www.oscommerce.com/community/contributions,3045)