Hello,
I have a query that I wrote to calculate the aging in days of a person's last logon to determine whether they are within Co policy. I would like to order by the aging date descending, but receive errors with every combination I've tried. My query is:
SELECT UserName, UserID, Status, LastLogon, DateDiff('d',Now(),LastLogon)*-1 AS DaysAging
FROM
(SELECT UserName, UserID, Status, format$(mid(lastlogindate,3,2) & "-" & right(lastlogindate,2) & "-" & left(lastlogindate,2),'mm/dd/yyyy') AS LastLogon FROM as400users WHERE Status="*Enabled")
Order by DateDiff('d',Now(),LastLogon)*-1 desc;
-----------------
I've also tried replacing the calculation in the order by with the alias name 'DaysAging' but that doesn't work either.
Finally is there a way to prevent the Access SQL code from adding the following once the query has been saved?
...Status="*Enabled"]. AS [%$##@_Alias];...
Any help is much appreciated.
I have a query that I wrote to calculate the aging in days of a person's last logon to determine whether they are within Co policy. I would like to order by the aging date descending, but receive errors with every combination I've tried. My query is:
SELECT UserName, UserID, Status, LastLogon, DateDiff('d',Now(),LastLogon)*-1 AS DaysAging
FROM
(SELECT UserName, UserID, Status, format$(mid(lastlogindate,3,2) & "-" & right(lastlogindate,2) & "-" & left(lastlogindate,2),'mm/dd/yyyy') AS LastLogon FROM as400users WHERE Status="*Enabled")
Order by DateDiff('d',Now(),LastLogon)*-1 desc;
-----------------
I've also tried replacing the calculation in the order by with the alias name 'DaysAging' but that doesn't work either.
Finally is there a way to prevent the Access SQL code from adding the following once the query has been saved?
...Status="*Enabled"]. AS [%$##@_Alias];...
Any help is much appreciated.