Group_concat Question
am 26.01.2007 21:54:55 von gmorrisI am attempting to pull data from multiple tables into a resultset that
I can use as an Excel spreadsheet for reporting. Here is my query so
far:
SELECT b.bug_id,p.realname as 'Assigned'
,bug_status,b.resolution,b.short_desc,l.thetext
as 'Description/Comments',b.creation_ts as 'Opened',b.delta_ts as 'Last
Update'
FROM bugs b, longdescs l, profiles p
WHERE b.bug_id=l.bug_id and b.assigned_to=p.userid and b.bug_status in
('new','assigned')
group by b.bug_id
order by bug_status,Opened
This produces what I need, except that for the field 'thetext' there is
a many to one relationship back to bug_id. I'm trying to use the
GROUP_CONCAT command, but when I add it:
SELECT b.bug_id,p.realname as 'Assigned'
,bug_status,b.resolution,b.short_desc,
Group_Concat (l.thetext) as 'Description/Comments',b.creation_ts as
'Opened',b.delta_ts as 'Last Update'
FROM bugs b, longdescs l, profiles p
WHERE b.bug_id=l.bug_id and b.assigned_to=p.userid and b.bug_status in
('new','assigned')
group by b.bug_id
order by bug_status,Opened
I get an error 1064 saying that the syntax is wrong near (l.thetext) on
line 2. I've tried quite a few variations with the parenthesis and
order but nothing seems to help.
Any suggestions or hints would be greatly appreciated! :-)
Thanks,
Gordon