Sorting two time fields in the same record

M

Mick

Hi, I have two time fields within each record of the database. Is it possible
to interleave the times from each recordso they are sequential.

e.g.
Record1, Time1 = 12.00 Time2 = 13.00 and Record2 Time1 = 12.30 Time2= 14.00

I want the query to report in this order Record1Time1 then record2Time1
then Record1Time2 then record2time2

Thank you in advance Mick
 
J

Jeff Boyce

Mick

One approach to this might be to create a UNION query that returns the times
from source1, source2, source3, source4, then sort that.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

Jerry Whittle

You could with a Union query something like below:

SELECT tblTimeInterleave.Time1 AS SortedTime,
tblTimeInterleave.Time1,
tblTimeInterleave.Time2
FROM tblTimeInterleave
UNION ALL
SELECT tblTimeInterleave.Time2 AS SortedTime,
tblTimeInterleave.Time1,
tblTimeInterleave.Time2
FROM tblTimeInterleave
ORDER BY SortedTime;
 
K

KARL DEWEY

Use a union query. Instead of primary key use a field that distinguishes
record1 from record2.
SELECT [Change Requests].Primary_Key, [Change Requests].[Date open] AS MyDate
FROM [Change Requests]
UNION
SELECT [Change Requests].Primary_Key, [Change Requests].[Date close] AS MyDate
FROM [Change Requests], [Change Requests] AS [Change Requests_1];
 
M

Mick

Many thanks to Jeff, Jerry and Karl for your swift replies. I will have a go
and let your all know how it went. Many thanks kind reagrds Mick
 
M

Mick

So far so good many thanks. I have a second question please. Each record also
has two date fields I also wish to interleave these two dates and the two
times as previous enquiry such that it produces a date and time order query
using both dates and times, thank you for your help,
Mick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top