On Wed, Nov 6, 2013 at 3:53 PM, Igor Tandetnik <i...@tandetnik.org> wrote:

> On 11/6/2013 8:50 AM, Dominique Devienne wrote:
>
>> On Wed, Nov 6, 2013 at 2:45 PM, Igor Tandetnik <i...@tandetnik.org>
>> wrote:
>>
>>  select g_id, :mypid,
>>>    (case when r.p_id is null then 'no' else 'yes' end) is_member
>>> from g left join r on (g.g_id = r.g_id and r.m_id = :mypid);
>>> order by (r.p_id is null), g_id;
>>>
>>
>> Nitpick: I'd put r.m_id = :mypid in a separate where clause, rather than
>> being on the join's ON clause.
>>
>
> That would filter out all 'no' rows. Try it, see for yourself. With an
> outer join, ON and WHERE clauses are not interchangeable.


Thanks Igor and Clemens, I stand correct, and I've learned something today.
Sorry for the misleading info. --DD
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to