ACC: How to Compare Data Among Records in a QueryID: Q122243
|
Moderate: Requires basic macro, coding, and interoperability skills.
You usually use code to compare data among records in a table. This article
describes how to use a query instead of code to compare data among records.
The following example demonstrates how to use a query to compare data among
the records in the Orders table in the sample database Northwind.mdb (or
NWIND.MDB in version 2.0). This query finds orders that were followed by
another order within 60 days:
Query: Compare Orders Query
---------------------------
Type: Select Query
Join: Orders.[CustomerID]<->Orders_1.[CustomerID]
Field: CustomerID
Table: Orders
Sort: Ascending
Field: OrderDate
Table: Orders
Sort: Ascending
Field: DaysBetweenOrders: DateDiff("d",[Orders].[OrderDate],_
[Orders_1].[OrderDate])
Criteria: Between 1 And 60
Field: OrderID
Table: Orders
Field: NextOrderDate: [OrderDate]
Table: Orders_1
For more information about queries, search the Help Index for "designing queries."
Additional query words: previous next
Keywords : QryHowto
Version : 2.0 7.0 97
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: April 8, 1999