Join two tables, then Order By date, BUT combining both tables...
Alright, I'm trying to figure out why I can't understand how to do this well...

I have two tables:

 - **invoices**: 
  - id
  - userID
  - amount
  - date

 - **payments**:
  - id
  - userID
  - amount
  - date

So, the goal here is to join both tables, where the userID matches whatever I want it to be - and then return everything ordered by date (most recent at the top).  However, because there is a date field in each of the tables, I'm not sure how MySQL will handle things... will is sort by both dates automatically?  Here's what I was thinking...

    "SELECT DISTINCT *
                FROM invoices,payments
                WHERE {$userID} = invoice.userID
                OR {$userID} = payments.userID
                ORDER BY date DESC";

But, it's starting to become clear to me that maybe this isn't even the right use of a join command...    maybe I need to just get all data on each table alone, then try to sort it somehow with PHP?  If that's the better method, what's a good way to do this type of DATE sort while keeping all row data in tact?

I should add, the TIME inside the unix timestamp (that's how "date" is stored) is NOT negligible - it should sort by the date and time.

Thanks all...
Join two tables, then Order By date, BUT combining both tables...
===

Alright, I'm trying to figure out why I can't understand how to do this well...

I have two tables:

 - **invoices**: 
  - id
  - userID
  - amount
  - date

 - **payments**:
  - id
  - userID
  - amount
  - date

So, the goal here is to join both tables, where the userID matches whatever I want it to be - and then return everything ordered by date (most recent at the top).  However, because there is a date field in each of the tables, I'm not sure how MySQL will handle things... will is sort by both dates automatically?  Here's what I was thinking...

    "SELECT DISTINCT *
                FROM invoices,payments
                WHERE {$userID} = invoice.userID
                OR {$userID} = payments.userID
                ORDER BY date DESC";

But, it's starting to become clear to me that maybe this isn't even the right use of a join command...    maybe I need to just get all data on each table alone, then try to sort it somehow with PHP?  If that's the better method, what's a good way to do this type of DATE sort while keeping all row data in tact?

I should add, the TIME inside the unix timestamp (that's how "date" is stored) is NOT negligible - it should sort by the date and time.

Thanks all...