Hi Kent,

Looks like

http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat

could help you. This is mysql specific function.

Kent Parker:
> Hi guys,
> 
> I'm stuck on a MySQL query problem.  I want to put the result of two
> ids in the same table into one row, based on an id in a third row.
> 
> eg:
> 
> "SELECT * FROM table1 AS t1 LEFT JOIN table2 AS t2 ON t1.fld1 =
> t2.fld1 LEFT JOIN table3 AS t3 ON t2.fld2 = t3.fld2 LEFT JOIN table4
> AS t4 ON t2.fld2 = t4.fld2 GROUP BY fld1"
> 
> For each row fld1 has only one value hence the GROUP BY, but fld2 can
> have two values.  What I want is to have any content from table3 and
> table4 that has a fld2 that is linked to fld1 included in each row of
> the query.  Then I want to sort on fields from both table3 and table4,
> so creating 2 queries is not going to help (or is it?).
> 
> I've searched the net but can't find out how I might do this.  Any
> pointers would be greatly appreciated.
> > 
> 


--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---

Reply via email to