I am using ZenCart and have created a custom query for retrieving order data. The only problem is that when I have products with attributes it creates 2 records with the same order. This is because that each product gets a record for the attributes it gets.
Here is my query:
I need to have all of the results for the specific product end up on the same line in my export. How can I accomplish this?PHP Code:SELECT
zo.orders_id as v_orders_id,
customers_id as v_customers_id,
customers_name as v_customers_name,
customers_company as v_customers_company,
customers_street_address as v_customers_street_address,
customers_suburb as v_customers_suburb,
customers_city as v_customers_city,
customers_postcode as v_customers_postcode,
customers_country as v_customers_country,
customers_telephone as v_customers_telephone,
customers_email_address as v_customers_email_address,
date_purchased as v_date_purchased,
orders_status_name as v_orders_status_name,
products_model as v_products_model,
products_id as v_products_id,
products_name as v_products_name,
products_options as v_products_options,
products_options_values as v_products_options_values
FROM ".TABLE_ORDERS_PRODUCTS." zop LEFT JOIN ".TABLE_ORDERS_PRODUCTS_ATTRIBUTES." opa
ON(zop.orders_products_id = opa.orders_products_id), ".TABLE_ORDERS." zo, ".TABLE_ORDERS_STATUS." zos
WHERE zo.orders_id = zop.orders_id
AND zop.orders_id BETWEEN '1' AND '800'
AND zo.orders_status = zos.orders_status_id
AND zop.products_id = '147'
Thanks in advance!



