- Joined
- May 17, 2005
- Messages
- 105
- Reaction score
- 0
[font=Verdana, Arial, Helvetica]I have an Access table with the following fields:
Pallet ID - eg. 11234$33
Location - eg. NW
Date/Time - eg. 10/10/2007 18:00:00
What I would like to do is have a query which shows me the latest record for
each Pallet ID.
[/font][font=Verdana, Arial, Helvetica]I have put the following string into an SQL Query:
SELECT [Job Variable Data].[Pallet ID], [Job Variable Data].[Date/Time],
[Job Variable Data].Location, [Job Variable Data].[User ID]
FROM [Job Variable Data] AS P1
WHERE [Job Variable Data].[Date/Time] =
(SELECT MAX([Job Variable Data].[Date/Time]
FROM [Job Variable Data] AS P2
WHERE P2 [Pallet ID] = P1 [Pallet ID]);
This string shows the table 'Job Variable Data' with the fields:
Pallet ID, Date/Time, Location and User ID
When I go to save it, it come up with the following error:
Missing ),], or Item in query expression'[Job Variable Data].[Date/Time] =
(SELECT MAX([Job Variable Data].[Date/Time]
FROM [Job Variable Data] AS P2
WHERE P2 [Pallet ID] = P1 [Pallet ID]);'.
Any ideas what I have done wrong as again, I have never used SQL?
HELP!!! This is driving me insane...
[/font]
Pallet ID - eg. 11234$33
Location - eg. NW
Date/Time - eg. 10/10/2007 18:00:00
What I would like to do is have a query which shows me the latest record for
each Pallet ID.
[/font][font=Verdana, Arial, Helvetica]I have put the following string into an SQL Query:
SELECT [Job Variable Data].[Pallet ID], [Job Variable Data].[Date/Time],
[Job Variable Data].Location, [Job Variable Data].[User ID]
FROM [Job Variable Data] AS P1
WHERE [Job Variable Data].[Date/Time] =
(SELECT MAX([Job Variable Data].[Date/Time]
FROM [Job Variable Data] AS P2
WHERE P2 [Pallet ID] = P1 [Pallet ID]);
This string shows the table 'Job Variable Data' with the fields:
Pallet ID, Date/Time, Location and User ID
When I go to save it, it come up with the following error:
Missing ),], or Item in query expression'[Job Variable Data].[Date/Time] =
(SELECT MAX([Job Variable Data].[Date/Time]
FROM [Job Variable Data] AS P2
WHERE P2 [Pallet ID] = P1 [Pallet ID]);'.
Any ideas what I have done wrong as again, I have never used SQL?
HELP!!! This is driving me insane...
[/font]