Subject RE: [firebird-support] Trouble with select
Author Leyne, Sean
Woody,

> > Im trying a bit difficult select:
> >
> > select id, value
> > from MyTable
> > where id in (1, 1, 1, 2, 3, 3, 4)
> >
>
> Try:
>
> select DISTINCT id, value
> from MyTable
> where id in (1, 1, 1, 2, 3, 3, 4)

You have misunderstood the Ops question. That would give him the exact same result he is seeing now.

He wants 1 row for each IN () list item, including duplicates -- which runs against conventional logic.

The only solution I can see is a UNION ALL, but that would be a very ugly SQL.


Sean