List:General Discussion« Previous MessageNext Message »
From:Arthur Fuller Date:September 23 2009 2:41pm
Subject:Re: Retrieving info from 2 tbls & ordering it
View as plain text  
I think that you can do what you want with a simple union query:
select * from incoming where user_id = 123
union
select * from outgoing where user_id = 123
order by datetime_received, datetime_sent

hth,
Arthur

On Wed, Sep 23, 2009 at 10:02 AM, Warren Windvogel <warren@stripped>wrote:

> Hi
>
> I have 2tables. 1 for incoming & the other for outgoing messages. They both
> have columns for the userid & datetime_received/sent. I'd like to retrieve
> all records from both tables for a specific user id & order all the records
> returned by the two datetime_received/sent fields. Is this possible & if so
> could someone help me out as to how I could achieve this.
>
> Kind regards
> Warren
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=1
>
>


-- 
Semi-retired SQL guru, interested in interesting projects not YAFOES (yet
another friendly order entry system).

Thread
Retrieving info from 2 tbls & ordering itWarren Windvogel23 Sep
  • Re: Retrieving info from 2 tbls & ordering itArthur Fuller23 Sep
    • RE: Retrieving info from 2 tbls & ordering itJohn23 Sep