Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: ORDER BY with static fields

Re: ORDER BY with static fields

From: Matt B. <mcb_at_fightspam.sd.znet.com>
Date: Thu, 24 Aug 2000 18:48:11 -0700
Message-ID: <sqbjr0u1t9113@corp.supernews.com>

"Joseph Ranseth" <jranseth_at_worldNO_SPAMcupfishing.com> wrote in message news:axfp5.1579$Io1.8259_at_news1.mts.net...
> I have a union query in which I am placing a static field to distinguish
> which table the data came from.
> When I have this field, it will not sort by another field - How can I get
> around this? (SQL included at bottom)
> ie:
> select a, b, 'tbl_a'
> from tbl_a
> union
> select a, b, 'tbl_b'
> from tbl_b
> order by b desc

Try ordering by the column's position?

select a, b, 'tbl_a'
from tbl_a
union
select a, b, 'tbl_b'
from tbl_b
order by 3

-Matt Received on Thu Aug 24 2000 - 20:48:11 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US