Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to sort dates from 2 different tables? 1

Status
Not open for further replies.

adnil

Technical User
Oct 29, 2003
50
GB
we need to display dates from 2 different tables and to sort these dates in ascending order in 1 single column, eg dates from table 1 are 1/4/10 and 5/4/10 and date from table 2 re 2/4/10 and 6/4/10, it should appear in the report as:

1/4/10
2/4/10
5/4/10
6/4/10

what should i do to achieve this? any advise will be greatly appreciated.

thank you.

 
The only thing I can think of is having a stored procedure that combines the tables and does the sorting for you.
 
Linda - I recognize my own name here :)

You could use a command like this:

select table1.date
from table1
union all
select table2.date
from table2

This would combine the dates into one column. Presumably you will have other fields. Keep in mind that fields in the same ordinal position on each side of the union all will be merged into one field, so you can plug these with 'null' (no quotes, if you don't want the fields merged.

-LB
 
Hi Linda, thanks for your suggestions. It has given me what I needed doing.

Thank you %-

Linda
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top