Limit result of one field while having another condition in another field

marcustofeles

New member
Local time
Today, 13:39
Joined
Oct 3, 2011
Messages
3
Hello world, newbie here

I'm trying to put together a small database for tracking and tracing a fleet of shipping containers. One function I need is to query which containers that are currently at one specific location.
The query below helps me to see what units are at a certain location, based on the input of the location name in a form field. However, if the same container have visited the location more than once then it shows up twice.

How can I limit the query to not show container duplicates? Also, I want the most recent dated location-visit to show, but I'm guessing that the ORDER BY-criteria take care of that.

SELECT Tracking.Container, Tracking.Location, Tracking.Arrivaldate, Tracking.Loaded, Tracking.Empty
FROM Tracking
WHERE (((Tracking.Location)=[Forms]![Containerpositioning]![location]))
ORDER BY Tracking.Arrivaldate DESC;

Regards
Marcus
 
Have you looked into the TOP syntax?

Code:
SELECT TOP 1 Tracking.Container, Tracking.Location, Tracking.Arrivaldate, Tracking.Loaded, Tracking.Empty
FROM Tracking
WHERE (((Tracking.Location)=[Forms]![Containerpositioning]![location]))
ORDER BY Tracking.Arrivaldate DESC;

I have no idea if that code is right, just read the concept here

http://www.w3schools.com/sql/sql_top.asp
 
Thank you for your reply my kiwi-friend!

Unfortunately that only shows me one container at the position in question. If there are several units then I need to see them too.

Going nuts over this...

/Marcus
 
There are many companies interested in our track consumer behavior. Recently it was revealed that Apple and Android track the GPS locations of users in some versions of the operating system. There are vehicles which are installed in gps car tracking to always be possible to know what their position, not only in the case of auto theft. There are special applications for fleet management or container tracking, useful for monitoring the location of all devices.
Someone said 'Big Brother'?
 

Users who are viewing this thread

Back
Top Bottom