[drupal-devel] couple of SQL questions
Moshe Weitzman
weitzman at tejasa.com
Mon Oct 10 14:21:26 UTC 2005
> 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.
More information about the drupal-devel
mailing list