View Single Post
Old 02-04-2013, 08:50 PM   PM User | #1
Kurisvo
New Coder

 
Join Date: Apr 2011
Posts: 59
Thanks: 8
Thanked 0 Times in 0 Posts
Kurisvo is an unknown quantity at this point
working with GROUP_CONCAT error

So I've been practicing with random queries and I've run into a problem

First off, here is my query:

Code:
SELECT a.username,
                 GROUP_CONCAT(items.id) AS itemslist,
                
         FROM a LEFT JOIN items ON items.owner = a.username          
         GROUP BY a.username
and that works perfectly for what I need (I need the items in a list, like the group_concat function gives me), except when there are no records for that user in the items table. I'm wondering if you can help me write a query that would work both ways? So it would return the list of users from the a table, no matter if they have items or not.
Kurisvo is offline   Reply With Quote