By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,145 Members | 1,619 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,145 IT Pros & Developers. It's quick & easy.

How to sort table data?

P: n/a
I need to import dates from a linked table then export them out as text to
an Excel spreadsheet. The problem is the dates need to be in ascending
order when I dump them out to Excel - and there's no telling what order they
are in in the linked table.

I've tried this:

INSERT INTO tblExcelData
SELECT [MeasurementId] AS TestID, [MeasurementDate] AS MeasDate,
[MeasurementTime] AS MeasTime
FROM Measurement
ORDER BY [MeasurementDate], [MeasurementTime];

But the dates don't appear in ascending order in tblExcelData.

When I dump them out to Excel, I'll need to concatenate:

MeasDate + " " + MeasTime (this is the text string goes to Excel - needs to
be text...)

So I need some way to sort the table while the data is in date format before
running another query to export as text into Excel.

What's the best way to sort the data in the table? Do I need an index?

Thanks in advance.

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In your table 'Measurement' are the fields MeasurementDate and MeasurementTime date/time-fields or text?
You will need date/time fields to sort on.
What's the best way to sort the data in the table? Do I need an index? When you use an autonumber as index, when your insert-query-records are in the right order, you will be allright.
Is there an index (maybe TestID) in your tblExcelData now?

Arno R

"deko" <de**@deko.com> schreef in bericht news:mG*****************@newssvr21.news.prodigy.co m...I need to import dates from a linked table then export them out as text to
an Excel spreadsheet. The problem is the dates need to be in ascending
order when I dump them out to Excel - and there's no telling what order they
are in in the linked table.

I've tried this:

INSERT INTO tblExcelData
SELECT [MeasurementId] AS TestID, [MeasurementDate] AS MeasDate,
[MeasurementTime] AS MeasTime
FROM Measurement
ORDER BY [MeasurementDate], [MeasurementTime];

But the dates don't appear in ascending order in tblExcelData.

When I dump them out to Excel, I'll need to concatenate:

MeasDate + " " + MeasTime (this is the text string goes to Excel - needs to
be text...)

So I need some way to sort the table while the data is in date format before
running another query to export as text into Excel.

What's the best way to sort the data in the table? Do I need an index?

Thanks in advance.


Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.