[drupal-devel] couple of SQL questions

Gordon Heydon gordon at heydon.com.au
Mon Oct 10 23:13:01 UTC 2005


Hi,

On Mon, 2005-10-10 at 10:19 -0400, Moshe Weitzman wrote:
> > My second question is that.
> > 
> > I have 2 tables, one is a teams table which has a list of entered teams.
> > The other table is a list of members for each team. One of the columns
> > is the name of the member. What I would like to do is create a select
> > from the team table which has a single column with a comma separated
> > list of members in a single field. This means I could sort and use it as
> > a method of detecting entries of multiple teams with the same members.
> > 
> > Or if anyone has a better ideas on how to detect duplicate entries would
> > be most appreciated.
> > 
> 
> That comma separated list can be done in MySQL 4.1+. See GROUP_CONCAT() 
> function at http://dev.mysql.com/doc/mysql/en/group-by-functions.html. 
> Eliminate dupes with a GROUP BY teamID.

Thanks for this. I will do some more investigation. If there any way of
detecting which version of mysql from the module, then I can utilise
this.

Thanks.

Gordon.




More information about the drupal-devel mailing list