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_at_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 Fri Aug 25 2000 - 03:48:11 CEST

Original text of this message