Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 4th, 2005, 08:28 PM
Authorized User
 
Join Date: Dec 2004
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default sort data

In a query, I have the following fields:
OrderNo.
CustomerName
Date
Price

I tried to sort the data by CustomerNamer whose OrderNo. has been sorted also. In the query, if I sort the Customer and OrderNo, but the OrderNo hasn't been sorted. Can anyone know the reason and how to fix it? Appreciated for any help!

flyfish
__________________
flyfish
 
Old February 4th, 2005, 09:07 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Order number is numeric or text field? (I think it should be numeric).

can u paste the SQL query, which u are using?


Om Prakash
 
Old February 6th, 2005, 02:32 AM
Authorized User
 
Join Date: Dec 2004
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The type of orderID is text.
I created the query in the design view, I think I can view the query in SQL view. Here is the SQL view of the query:
SELECT tbl_order_summary.EmpoyeeID, tbl_order_summary.CompanyName, tbl_order_summary.OrderID, tbl_order_summary.OrderedDate
FROM tbl_order_summary
ORDER BY tbl_order_summary.CompanyName;

I am wonerding how can I sort the orderID also?

Thank you for your reply!

flyfish
 
Old February 6th, 2005, 03:13 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

If you want to sort the numeric OrderID (and if it is all numeric, then you can use convert(int,OrderID) in order by clause. but this will give u error when there is text content).


Om Prakash
 
Old February 6th, 2005, 09:13 PM
Authorized User
 
Join Date: Dec 2004
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I still do not know why I can only sort one field in the query, even if I tried to sorted the data by CustomerName and Date. After I run the query, only the leftmost column has been sorted. Why?

Appreciated for any replies!

flyfish
 
Old February 7th, 2005, 02:51 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi

Set both fields sorting ascending. Here is the SQL syntax

SELECT tbl_order_summary.EmpoyeeID, tbl_order_summary.CompanyName, tbl_order_summary.OrderID, tbl_order_summary.OrderedDate
FROM tbl_order_summary
ORDER BY tbl_order_summary.CompanyName, tbl_order_summary.OrderedDate;

-vemaju






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to sort data in a data grid? zaheerabbas.sk ASP.NET 1.0 and 1.1 Basics 3 April 10th, 2007 02:37 PM
dynamic sort - data-type (using xsl2.0 with saxon) ronisc XSLT 2 December 5th, 2006 05:39 AM
datagrid does SORT integer data properly chayanvinayak Flash (all versions) 3 July 27th, 2006 02:59 PM
How to sort a column in data grid: kenn_rosie ASP.NET 1.0 and 1.1 Basics 1 January 26th, 2006 02:03 PM
trying to sort data in excel with vb.net deanna VB How-To 0 March 26th, 2004 04:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.