Access 2000 - First record by Item

Dear Experts,

Can you please check the attached small database, it contains Table1 and based on that Query1 orders its records.

Could you advise about a query which would bring the first record of Query1 for each Item?

In query "NotGood" I have tried to apply the Item to be Group By and the others as First, but in this way not correct because I would need the first whole record line by Item, not that individually what is the first in fields

thanks,
KeepOrder.zip
LVL 1
csehzIT consultantAsked:
Who is Participating?
 
Rey Obrero (Capricorn1)Commented:
create this make table query first, then run

SELECT Table1.Item, Table1.Agreement, Table1.Fixed, Table1.Date INTO Table2
FROM Table1
ORDER BY Table1.Item, Table1.Agreement DESC , Table1.Fixed DESC , Table1.Date DESC;


then, create this query

SELECT Table2.Item, First(Table2.Agreement) AS FirstOfAgreement, First(Table2.Fixed) AS FirstOfFixed, First(Table2.Date) AS FirstOfDate
FROM Table2
GROUP BY Table2.Item;
0
 
Rey Obrero (Capricorn1)Commented:
clarify this  <first record of Query1 for each Item? > what are the criteria ?

from your sample db, post the records you want to see returned as the result of the query..
0
 
Rey Obrero (Capricorn1)Commented:
copy and this SQL and paste in the SQL view of a new query

SELECT T.Item, T.Fixed, T.Date, T.Agreement
FROM Table1 AS T
Inner Join
(select min(T2.Date) As MinDate, T2.Item
 From Table1 as T2
 Group by T2.Item
) As T3
On T.Item=T3.Item and T.Date=T3.MinDate

is that the result yo want to see?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
csehzIT consultantAuthor Commented:
Basically just keeping the ordering result of Query1

Item      Agreement      Fixed      Date
101      41332            2011-11-01
102      41332            2011-11-06
103      41339      X      2011-11-23
104            X      2011-11-01

thanks,
0
 
Rey Obrero (Capricorn1)Commented:
there are fields in your table that are Null, are you sure these are correct?
0
 
csehzIT consultantAuthor Commented:
Thanks I have tried but that gives different result for me.

Maybe I could explain this "first record" expression through Excel, so for example if we would use formula Vlookup based on Item, that would give the first row always as result, for example =VLOOKUP(A2;Query1!A:D;4;0)
0
 
csehzIT consultantAuthor Commented:
Yes the Null values in table are correct, as the live download like this comes from SAP.

0
 
csehzIT consultantAuthor Commented:
Could you please have a short look on the attached excel file, so I would like the same result in Access which is on Sheet1 in Excel

thanks,
Query1.xlsx
0
 
csehzIT consultantAuthor Commented:
Thanks it works
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.