On Jan 30, 2008 5:25 PM, Jerry Schwartz <[EMAIL PROTECTED]> wrote:
> The problem starts when I try to fetch the memos. I want one email address,
> two or more customer_ids (so I can tell them apart), and all of the memos
> for each customer_id (preferably using GROUP_CONCAT(). In other words, this
> is what I want:
>
> [EMAIL PROTECTED]  fred_id_1  fred_memos_1
>                fred_id_2  fred_memos_2
>                fred_id_3  fred_memos_3
> [EMAIL PROTECTED]  john_id_1  john_memos_1
>                john_id_2  john_memos_2

So an e-mail can have more than one customer_id and a customer_id can
have more than one memo?  You can't group by both e-mail and
customer_id separately in the same query.  You could do some stunts
using subqueries, but it's really not worth it.  It would be much
better to drop GROUP_CONCAT, do a simple query with an ORDER BY on
email and customer_id, and consolidate the data into the structure you
want in your code.

- Perrin

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

Reply via email to