Thanks for such a speedy response. I couldn't get you solution to work.
However it was great help in pointing me in the right direction. Thanks
again.

What did work was:-

(SELECT a.CID AS ID, a.ItemName AS TEXT FROM customlists a)
UNION
( SELECT b.GID AS ID, b.ItemName AS TEXT FROM globallists b)
ORDER BY TEXT;

Charlie
 
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of HOPE 4 BEST
Sent: 15 May 2008 07:21
To: [email protected]
Subject: Re: [php_mysql] Combining date from 2 tables

HERE IS UR SOLUTION----
the query for this should be --
*SELECT ID,TEXT FROM ((SELECT a.CID AS ID, a.ItemName AS text FROM
customlists a) UNION( SELECT b.GID AS ID, b.ItemName AS text FROM
globallists b)) c ORDER BY c.TEXT;
*

Result may vary while we use UNION ALL instead of UNION.

Regards,
SHAHAJI.
http://phpinterviewanswers.blogspot.com/


On Thu, May 15, 2008 at 11:23 AM, Charlie Markwick <[EMAIL PROTECTED]>
wrote:

>   Say I had two tables.
>
> GLobalLists
>
> GID ItemName
>
> 1 Bulldog
> 2 Elephant
> 3 Crocodile
>
> CustomLists
>
> CID ItemName
>
> 10001 Aardvark
> 10002 Cane Toad
> 10003 Giraffe
>
> Is it possible to run a select that combines the two and then sorts on

> ItemName to give me a record set:-
>
> 10001 Aardvark
> 1 Bulldog
> 10002 Cane Toad
> 3 Crocodile
> 2 Elephant
> 10003 Giraffe

Reply via email to