Re: Simple SQL Question

From: Spencer <spencerp_at_swbell.net>
Date: Wed, 21 Feb 2001 19:34:59 -0600
Message-ID: <N0_k6.566$1p6.92840_at_nnrp2.sbc.net>


the UNION ALL set operator will likely perform better than the UNION set operator, since it does not eliminate duplicates.

select field1, field2
  from mytable
UNION ALL
select field1, field3
  from mytable
UNION ALL
select field1, field4
  from mytable

i don't see any other way around the problem, given the confines of the table structure.

"Jeff Anderson" <jeanderso9_at_yahoo.com> wrote in message news:k2ji6.127179$9v2.1660112_at_quark.idirect.com...
> Is there a simple way to query a table whose records are formatted as
> follows:
>
> FIELD1 VARCHAR(12) - Ex. Data: NORTH
> FIELD2 VARCHAR(12) - Ex. Data: 1000
> FIELD3 VARCHAR(12) - Ex. Data: 2000
> FIELD4 VARCHAR(12) - Ex. Data: 3000
>
> with a result set that contains multiple records in the following format:
>
> NORTH 1000
> NORTH 2000
> NORTH 3000
>
> without doing a UNION? We're trying to avoid changing the table structure
> and the overhead of runniing UNION statements.
>
> Thanks.
>
>
Received on Thu Feb 22 2001 - 02:34:59 CET

Original text of this message