Show last date only.

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

I have a query that posts all the data in descending order. I want to show
the last entry only. Is that possible? Here is my query.


SELECT tblBuildsWAR.BuildNumber, tblBuildsWAR.PreviousStatus,
tblBuildsWAR.CurrentStatus, tblWAR.StartDate, tblWAR.EndDate,
tblBuildsWAR.WarFK
FROM tblWAR INNER JOIN tblBuildsWAR ON tblWAR.WARPK = tblBuildsWAR.WarFK
ORDER BY tblWAR.StartDate DESC;


I would assume to have something look into the tblBuildsWAR.WarFK field, but
I'm not sure.
 
a TOP 1 with the ORDER BY reversed:



SELECT TOP 1 tblBuildsWAR.BuildNumber, tblBuildsWAR.PreviousStatus,
tblBuildsWAR.CurrentStatus, tblWAR.StartDate, tblWAR.EndDate,
tblBuildsWAR.WarFK
FROM tblWAR INNER JOIN tblBuildsWAR ON tblWAR.WARPK = tblBuildsWAR.WarFK
ORDER BY tblWAR.StartDate ASC;




Vanderghast, Access MVP
 
I used the SQL code below but it returns the first record, not the last. The
last record should be WarFK = 11. It returns WarFK = 1.

Let me know how to change this.

Thanks

Ben
 
Change the order ASC to DESC:


SELECT TOP 1 tblBuildsWAR.BuildNumber, tblBuildsWAR.PreviousStatus,
tblBuildsWAR.CurrentStatus, tblWAR.StartDate, tblWAR.EndDate,
tblBuildsWAR.WarFK
FROM tblWAR INNER JOIN tblBuildsWAR ON tblWAR.WARPK = tblBuildsWAR.WarFK
ORDER BY tblWAR.StartDate DESC;



Vanderghast, Access MVP
 
Back
Top