Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Query Question to return array

10:44 am on Jul 18, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:Jan 4, 2005
votes: 0

Hi there,

I can't seem to figure this out. It's using MySQL.

I would like all cn.notes to be returned in an array if there are multiple notes.

I have this query:

SELECT *, GROUP_CONCAT(cn.notes) as all_notes FROM CUSTOMERS as c JOIN customer_notes as cn on cn.customers_id_fk = c.customer_id LEFT JOIN customer_url as cu on cu.customers_id_fk = c.customer_id LEFT JOIN sales as s on s.url_id_fk = cu.url_id WHERE c.customer_id = 6 GROUP BY cn.notes_id

This only returns the last note in the DB.

Any help would be great!
1:07 pm on Aug 18, 2011 (gmt 0)


WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
votes: 3

Is cn.notes_id a PRIMARY KEY? If so, you are grouping on it and will only get 1 row returned.

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members