CONCAT_WS rows in JOIN

Posted by Alex Kiselev on Stack Overflow See other posts from Stack Overflow or by Alex Kiselev
Published on 2013-06-28T21:56:52Z Indexed on 2013/06/28 22:21 UTC
Read the original article Hit count: 105

Filed under:
|

i have tables

profiles (id, name, deleted)
categories (id, name, deleted)
profiles_categories (id, profile_id, category_id, , deleted)

I have wrong query

SELECT p.id, p.name CONCAT_WS(', ', c.name) AS keywords_categories
FROM profiles p
LEFT JOIN profiles_categories pc ON p.id = pc.profile_id
LEFT JOIN categories c ON pc.id = c.id
WHERE p.deleted = FALSE 

So, i want have result with all profiles with concan categories.name.

Thanks

© Stack Overflow or respective owner

Related posts about mysql

Related posts about sql