Top 1 subquery (most current change) Help!

A

Abbey Normal

Hi. I am trying to write a sub query for an Audit Log that shows only the
most current change for this sku. I have to pass the sku in, and it works
fine for getting all the records associated with this sku. I have looked at
the subquery examples, but can't figure out where to add it. Can anyone show
me how to add it? Thank you,
Here is the original query:

SELECT AuditLog.Reason, AuditLog.user, AuditLog.chgdate
FROM Glass INNER JOIN AuditLog ON Glass.SKU = AuditLog.Sku
WHERE (((AuditLog.Sku)=[Forms]![Glass]![sku]))
ORDER BY AuditLog.chgdate DESC;
 
A

Abbey Normal

Okay, I get the query to work written like this:
SELECT TOP 1 AuditLog.Reason, AuditLog.chgdate, AuditLog.user
FROM AuditLog
WHERE (((AuditLog.Sku)=[Forms]![Glass]![sku]))
ORDER BY AuditLog.chgdate DESC;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Help with complicated query 8
Help! with query criteria for report 3
TOP 1 in INNER JOIN 2
Top 3 per group 3
Subquery help 7
Help with a subquery 5
SubQuery Assistance... 2
subquery help 1

Top