Re: Urgent help please

From: Lennart Jonsson <lennart_at_kommunicera.umea.se>
Date: 21 Aug 2003 23:09:03 -0700
Message-ID: <6dae7e65.0308212209.119ef0c0_at_posting.google.com>


"Alan" <alanpltse_at_yahoo.com.au> wrote in message news:<3f45784a_at_news.comindico.com.au>...
> Candy is not included before she is a child of Alan.
> I only want to include the top level parent.
>

select

    x1.name, x1.age
from

    x x1, x c
where

    x1.age > 20 and x1.parent is null
group by

    x1.name, x1.age
having

    count(case when c.parent = x1.id and c.age < 20 then 1 else null end) = 0

if "CASE WHEN ..." is not supported by mysql, you could perhaps use "IF ..."? I've seen "IF ..." in Q/A for mysql, so I guess "CASE ..." is not supported? Received on Fri Aug 22 2003 - 08:09:03 CEST

Original text of this message