Advertisement

04.01.2008 at 11:07PM PDT, ID: 23288242
[x]
Attachment Details

SQL limit rows in joined table

Asked by hpsupport in SQL Query Syntax

Tags: Microsoft, Access, 2003

hey,

i have an Access sql query that join a few tables. However one particular table, i only want to return one row. See bellow

I only need the most recent Date field from the MatOut table. At the moment it is returning all the rows associated with the PartNo.

How do i limit it to only showing the most recent date field.


many thanx

nathanStart Free Trial
1:
2:
3:
SELECT Parts.ShortID AS PART, Parts.Description AS DESCRIPTION, Sum(PartsActive.Units) AS UNITS, Parts.curCost AS [CURRENT COST], Sum(Parts.curCost*PartsActive.Units) AS TOTAL, PartsActive.[Date In] AS DateIn, MatOut.Date AS DateOut
FROM (Parts RIGHT JOIN ((PartsActive LEFT JOIN Vendor ON PartsActive.Associate = Vendor.Rec) LEFT JOIN tblCompanyInfo ON PartsActive.WID = tblCompanyInfo.Rec) ON Parts.PartNo = PartsActive.Part) LEFT JOIN MatOut ON PartsActive.Part = MatOut.PartNo
GROUP BY Parts.ShortID, Parts.Description, Parts.curCost, PartsActive.[Date In], Vendor.Name, PartsActive.Active, Parts.DC, MatOut.Date;
[+][-]04.01.2008 at 11:11PM PDT, ID: 21260488

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: SQL Query Syntax
Tags: Microsoft, Access, 2003
Sign Up Now!
Solution Provided By: angelIII
Participating Experts: 2
Solution Grade: A
 
 
[+][-]04.01.2008 at 11:12PM PDT, ID: 21260492

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.25.2008 at 03:47PM PDT, ID: 21443708

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628