On Mon, Jun 04, 2012 at 09:13:51PM +0200, Gert Van Assche scratched on the wall:

> SELECT DISTINCT
> group_concat( [TB].[F2],' ')  AS [Groep]
> FROM [TA] JOIN [TB] ON [TA].[Groep] = [TB].[Groep];
> 
> I get this as a result:
> Groep
> 1 2 *3 3*
> 
> but I would like to get
> Groep
> 1 2 *3*
> 
> I'm sure the JOIN is causing this doubling of elements in the grouped
> result.

  Yes, there will be two "3" rows returned, which are then fed into the
  group_concat() aggregate.  The result is only one row, however, so it
  is always distinct.


> Is there a way I could achieve this?

  You want the DISTINCT on the aggregate, not the result set:

  SELECT group_concat( DISTINCT TB.F2, ' ' ) AS....


   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to