<sigh> In all of that information, I forgot to post the actual query:

INSERT INTO consolidated_customer_data
    SELECT
        customers.customer_id,
        account.account_name,
        customers.email,
        customers.email_status,
        customers.dm_status,
        customers.status,
        customers.last_name,
        customers.first_name,
        customers.sal,
        customers.company,
        customers.address_1,
        customers.address_2,
        customers.address_3,
        customers.country,
        customers.zip,
        customers.input_source,
        customers.interest_category,
        customers.interest_subcategory,
        CONCAT("|", GROUP_CONCAT(cust_topics.topic_code SEPARATOR "|"), "|")

            AS topic_list,
        stage.stage_name
    FROM
        customers JOIN account ON account.account_id = customers.account_id
        JOIN stage ON customers.stage_id = stage.stage_id
        LEFT JOIN cust_topics ON customers.customer_id =
cust_topics.customer_id
    GROUP BY customers.customer_id;

Regards,

Jerry Schwartz
The Infoshop by Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032

860.674.8796 / FAX: 860.674.8341

www.the-infoshop.com
www.giiexpress.com
www.etudes-marche.com





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to