Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Access 2000 - First record by Item

Posted on 2011-09-26
9
243 Views
Last Modified: 2012-05-12
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
0
Comment
Question by:csehz
  • 5
  • 4
9 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36598860
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
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36598881
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
 
LVL 1

Author Comment

by:csehz
ID: 36598884
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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36598914
there are fields in your table that are Null, are you sure these are correct?
0
 
LVL 1

Author Comment

by:csehz
ID: 36598921
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
 
LVL 1

Author Comment

by:csehz
ID: 36598942
Yes the Null values in table are correct, as the live download like this comes from SAP.

0
 
LVL 1

Author Comment

by:csehz
ID: 36598976
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
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 36599817
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
 
LVL 1

Author Closing Comment

by:csehz
ID: 36707596
Thanks it works
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question