Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / April 2008

Tip: Looking for answers? Try searching our database.

Select min value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rafi - 17 Apr 2008 17:38 GMT
I have a query listing the transit time between two given origin points (zip
codes) and multiple destinations.  I am trying to limit the results to the
one combination that list the smallest transit time -
Min(GND_TRANSIT.[SERVICE DAYS]) AS [Min DAYS]- and if the two origins have
equal transit times than select the one having the smallest value for Zone -
Min(GND_TRANSIT.ZONE) AS MinZONE.  Unfortunately, the results show both
values rather than just obe row.

Your help is much appreciated.

SELECT DISTINCTROW GND_TRANSIT.DEST_ZIP, Min(GND_TRANSIT.[SERVICE DAYS]) AS
[Min DAYS], Min(GND_TRANSIT.ZONE) AS MinZONE, GND_TRANSIT.Origin
FROM GND_TRANSIT INNER JOIN Shipments ON (GND_TRANSIT.DEST_ZIP =
Shipments.DEST_ZIP) AND (GND_TRANSIT.DEST_ZIP = Shipments.DEST_ZIP)
GROUP BY GND_TRANSIT.DEST_ZIP, GND_TRANSIT.Origin;
akphidelt - 17 Apr 2008 17:59 GMT
This is untested but you might be able to

SELECT TOP 1

Then sort the Min Days ascending and MinZone as Ascending

Once again, untested but its something that could be pulled off

> I have a query listing the transit time between two given origin points (zip
> codes) and multiple destinations.  I am trying to limit the results to the
[quoted text clipped - 11 lines]
> Shipments.DEST_ZIP) AND (GND_TRANSIT.DEST_ZIP = Shipments.DEST_ZIP)
> GROUP BY GND_TRANSIT.DEST_ZIP, GND_TRANSIT.Origin;
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.