🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #616

Re: union with order by

#616
From: Robin
Date: Wed, 29 Aug 2007 03:05
43 lines
1741 bytes
John Hart wrote:
> Hi, I want to merge two or more tables and order them but I can't seem to 
> get it to work, below is a simplified sql that I tried after my original one 
> failed.

Hi John,

Reference the fields you want to order by with their sequence number 
rather then the fields name.

Ie:

select
name, created
from
TWSUPPLIER

union

select
name, created
from
TWCUSTOMER

union

select
mydesc as name, created
from
TWPRODUCT

order by
2

Also, make sure that mydesc and two name fields are the same type.

If you still have trouble, be sure to post the error message you get :-)

-- 
Robin.

Australian Bridal Accessories := http://www.bridalbuzz.com.au
Turbo for Noobs (a work in progress) := http://turbofornoobs.blogspot.com/
Technical Details
Message-ID: <46d4e240$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <46d4dfbd$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,2606ab9c57d082e6
X-Google-Attributes: gid114a0e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Wed, 29 Aug 2007 13:05:10 +1000
From: Robin <Robin@.com>
User-Agent: Thunderbird 1.5.0.12 (Windows/20070509)
MIME-Version: 1.0
Newsgroups: borland.public.interbase.sql
Subject: Re: union with order by
References: <46d4dfbd$1@newsgroups.borland.com>
In-Reply-To: <46d4dfbd$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 165.228.6.111
Message-ID: <46d4e240$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1188356672 165.228.6.111 (28 Aug 2007 20:04:32 -0700)
Lines: 43
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail