> SELECT DISTINCT
> group_concat( [TB].[F2],' ')  AS [Groep]
> FROM [TA] JOIN [TB] ON [TA].[Groep] = [TB].[Groep];

You probably want to do the following here:

SELECT group_concat([F2],' ') AS [Groep]
FROM (
SELECT DISTINCT [TB].[F2] AS [F2]
FROM [TA] JOIN [TB] ON [TA].[Groep] = [TB].[Groep]
);


Pavel


On Mon, Jun 4, 2012 at 3:13 PM, Gert Van Assche <ger...@gmail.com> wrote:
> All,
>
> I'm sure this is not an SQLite bug, but I hope I can get rid of it:
>
> CREATE TABLE "TA"([Groep], F1);
> CREATE TABLE "TB"([Groep], F2);
>
> INSERT INTO [TA]([Groep], [F1]) VALUES('1', 'ABC');
> INSERT INTO [TA]([Groep], [F1]) VALUES('2', 'DE');
> INSERT INTO [TA]([Groep], [F1]) VALUES('3', 'F');
> INSERT INTO [TA]([Groep], [F1]) VALUES('3', 'G');
>
> INSERT INTO [TB]([Groep], [F2]) VALUES('1', '1');
> INSERT INTO [TB]([Groep], [F2]) VALUES('2', '2');
> INSERT INTO [TB]([Groep], [F2]) VALUES('3', '3');
>
> 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.
> Is there a way I could achieve this?
>
>
> thanks
>
>
> Gert
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to