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 / July 2006

Tip: Looking for answers? Try searching our database.

Need assistance to write a query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike - 19 Jul 2006 18:29 GMT
Let’s assume after merging few tables I have the following t1 query with 2
columns
(pk and number)

PK           numbers
1             5
1             6
1             7
2             9
2             50
2             60
3             40
3             44

I would like to write a query that gives me the first rows that the
t1.number is minimum when the t1.pk is the same. The output should look like
the following:

1          5
2          9
3           40

Any help is greatly appreciated.
Ken Sheridan - 19 Jul 2006 18:52 GMT
Group by the PK column and use the MIN function to return the lowest Numbers
value for each PK:

SELECT PK, MIN(Numbers) AS MinNumber
FROM T1
GROUP BY PK;

Ken Sheridan
Stafford, England

> Let’s assume after merging few tables I have the following t1 query with 2
> columns
[quoted text clipped - 19 lines]
>
> Any help is greatly appreciated.
Jeff L - 19 Jul 2006 18:59 GMT
Make a query that outputs PK and Numbers.  Now click View, Totals or
click the Totals icon in the toolbar.  For PK, the Total row should be
Group By and for Number it should be Min.

Hope that helps!
 
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



©2008 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.