I am trying to write a SELECT statement, which brings in information from 2 tables. I would like to be able to ORDER BY date fields from both tables.
For example:
If table a, and table b, both have a date field: a_date and b_date, I would like the results from both tables to ORDER BY both of the tables combined. So, if the result set included:
a_date: 2002-01-01
a_date: 2002-01-02
a_date: 2002-01-03
b_date: 2002-01-04
a_date: 2002-01-05
a_date: 2002-01-06
The b_date was ordered properly in this result set. Currently I have 2 select statements, and process the order in my scripting language (PHP) to obtain my desired result. I know there must be a more efficient way of using the SELECT statement to achieve this.
Thanks in advance for any insight.
- Bruce
Bruce Garlock
bruceg@tiac.net
For example:
If table a, and table b, both have a date field: a_date and b_date, I would like the results from both tables to ORDER BY both of the tables combined. So, if the result set included:
a_date: 2002-01-01
a_date: 2002-01-02
a_date: 2002-01-03
b_date: 2002-01-04
a_date: 2002-01-05
a_date: 2002-01-06
The b_date was ordered properly in this result set. Currently I have 2 select statements, and process the order in my scripting language (PHP) to obtain my desired result. I know there must be a more efficient way of using the SELECT statement to achieve this.
Thanks in advance for any insight.
- Bruce
Bruce Garlock
bruceg@tiac.net