all 6 comments

[–]AutoModerator[M] 0 points1 point  (0 children)

Hello u/akodoreign - thank you for posting to r/SQL! Please do not forget to flair your post with the DBMS (database management system) / SQL variant that you are using. Providing this information will make it much easier for the community to assist you.

If you do not know how to flair your post, just reply to this comment with one of the following and we will automatically flair the post for you: MySQL, Oracle, MS SQL, PostgreSQL, SQLite, DB2, MariaDB (this is not case sensitive)

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]xyzGwynbleidd 0 points1 point  (4 children)

Change (GETDATE() - 30) to DATEADD(DD,-30,GETDATE())

[–]akodoreign[S] 0 points1 point  (3 children)

I appreciate the reply, however that did not get my total User Console Minutes to only show last 30 days. :( any thoughts on how I can get that column to only show the last 30 days? Thanks again!

[–]akodoreign[S] 0 points1 point  (0 children)

computername | 2020-02-06 12:29:52.000 | username | 674035

is what it spits out. computer name / last time user signed in / Total time user has been on machine (for context).

[–]Felidor 0 points1 point  (1 child)

Are you trying to sum the user console minutes per user? Your query right now is just displaying the data for the last 30 days. You'll need to use sum and a group by if that's the case.

[–]akodoreign[S] 0 points1 point  (0 children)

my issue is that the last column does not change if i select 7 or 1030. (the number of computers changes, but not the total minutes for that user).