Re: newton binomial coefficient
Date: Wed, 02 Apr 2003 11:35:12 +0000
Message-ID: <2719421.1049283312_at_dbforums.com>
Originally posted by Kamal
> >
> > select t1.name, t2.name
> > from things t1, things t2
> > where t1.id < t2.id
>
> Sorry, I didn't explain very well.
>
> Here's what I obtained from your query:
>
> NAME NAME
> ------------------------------ --------
> car home
> car car
> home car
>
> I would like to group by these two columns, but without any order.
>
> For example, I don't want "car - home" and "home - car", but just one
> couple "car - home" or "home - car", without repetition.
>
> And then, why do you filter the query this way (where t1.id < t2.id)?
> What if I haven't this integer column?
>
> BTW, thank you for the answer.
>
> Kamal
select t1.thing, t2.thing
from things t1, things t2
where t1.thing < t2.thing
order by t1.thing, t2.thing;
THING THING -------------------- -------------------- car dog car home car woman dog home dog woman home woman
Not quite the same result as you asked for, but it is equivalent to it. The condition t1.thing < t2.thing prevents you from getting both "car dog" and "dog car". Without any other column to indicate precedence, "car dog" and "dog car" are equally valid results.
I added the ORDER BY clause only to make the result easier to follow.
-- Posted via http://dbforums.comReceived on Wed Apr 02 2003 - 13:35:12 CEST