Subject Re: [firebird-support] Confused about JOINS, and how to solve the following
Author Richard Mace
>
>
> There are at least four different ways to do it: You can use DISTINCT or
> GROUP BY or EXISTS or IN.
>
> select distinct userid
> from users_groups
> where group_id in (list of groups);
>
> select userid
> from users_groups
> where group_id in (list of groups)
> group by group_id;
>
> select u.id
> from users u
> where exists (
> select 1 from users_groups g
> where u.id = g.userid
> and group_id in (list of groups)
> );
>
> select u.id
> from users u
> where u.id in (select g.userid from users_groups g
> where group_id in (list or groups));
>
> Of course, if you need more that userid, then you need a JOIN in first
> two queries.
>

Thanks for the reply.
Yes, I would need a lot more, so would need to use a JOIN, but am still
learning.
Could you give me an idea of the syntax please?

Thanks

Richard


[Non-text portions of this message have been removed]