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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sort by 2 colums as 1

Status
Not open for further replies.

Icelizard

Programmer
Feb 9, 2006
17
0
0
GB
I have 2 tables lets say called: files and notes
files has 2 fileds filname and date_added
notes has 2 fields note subject and date_added

if files had 2 records:
1) file1.pdf : 2007-06-14
2) file2.pdf : 2007-06-17

if files had 2 records:
1) great day out : 2007-06-15
2) why me? : 2007-06-18

i want to sort by the date in both fields but as if they were in 1 fields so output would be
2007-06-14
2007-06-15
2007-06-16
2007-06-17
and not
2007-06-14
2007-06-17
2007-06-15
2007-06-18

Any help would be breatly appreciated
 
(select filename a, date_added b from files)
union
(select subject a, date_added b from notes)
Order by b

That should do it.

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top