Re: Avoid multiple scan of the same table

From: <>
Date: 21 Aug 2008 16:11:26 GMT
Message-ID: <20080821121128.112$> wrote:
> Is there way to avoid multiple scan of the same table in following?
> Select c1 as v1, c2 as v2, c3 as v3
> From t1
> Union
> Select c1 as v1, c2 as v2, c4 as v3
> From t1
> Where c5 < 5000
> The output should look like..
> v1, v2, v3
> v11, v21, v31
> v12, v22, v32
> and so on.
> Rows from the both queries can be same so UNION is required to avoid
> duplicates in current construct.

So rows with c5<5000 are supposed to be returned twice, except when c3 and c4 happen to be the same, then it should only be returned once?


-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
Received on Thu Aug 21 2008 - 11:11:26 CDT

Original text of this message