Avoid multiple scan of the same table

From: <maks71_at_gmail.com>
Date: Thu, 21 Aug 2008 07:04:04 -0700 (PDT)
Message-ID: <aca47eaa-ded6-4015-985b-bfd5739e7491@s50g2000hsb.googlegroups.com>

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. Received on Thu Aug 21 2008 - 09:04:04 CDT

Original text of this message