Maximo List Archive

This is an archive of the Maximo Yahoo Community. The content of this pages may be a sometimes obsolete so please check post dates.
Thanks to the community owner Christopher Wanko for providing the content.



Login Tracking

From: George (2012-03-09 01:35)

Ok everyone I need a little help with SQL stuff.
If you look below I have the following query to return for a certain user, but when I execute it I get like 4 thousand results back. How can I tell it to just return the last attemptdate?
select userid,attemptdate from logintracking
where userid = 'SMASSEY'
I have to get the last attempt dates for all our user for an audit.
If I just run
select * from logintracking
it will return every login for all users and going thru all those for the last time they logged in would take me a while.
So I hope ya can help me out.
Maximo 6.2.1
SQL Server 2005
thx,
mrggutz


From: Chris Lawless (2012-03-08 20:37)

Google HAVING MAX(ATTEMPTDATE)
:)
Chris.
On Mar 8, 2012, at 8:35 PM, "George" <ggutierrez@pasadenarefining.com> wrote:
> Ok everyone I need a little help with SQL stuff.
> If you look below I have the following query to return for a certain user, but when I execute it I get like 4 thousand results back. How can I tell it to just return the last attemptdate?
> select userid,attemptdate from logintracking
> where userid = 'SMASSEY'
>
> I have to get the last attempt dates for all our user for an audit.
> If I just run
> select * from logintracking
> it will return every login for all users and going thru all those for the last time they logged in would take me a while.
> So I hope ya can help me out.
>
> Maximo 6.2.1
> SQL Server 2005
>
> thx,
> mrggutz
>
>


From: Travis Herron (2012-03-09 14:30)

Try this:
SELECT userid, MAX(attemptdate)
FROM logintracking
GROUP BY userid
ORDER BY userid
(that last line -- ORDER BY -- is optional; you can sort it or not sort it however you wish)
Travis Herron
--- In MAXIMO@yahoogroups.com, Chris Lawless <lawlessc@...> wrote:
>
> Google HAVING MAX(ATTEMPTDATE)
>
> :)
>
> Chris.
>
> On Mar 8, 2012, at 8:35 PM, "George" <ggutierrez@...> wrote:
>
> > Ok everyone I need a little help with SQL stuff.
> > If you look below I have the following query to return for a certain user, but when I execute it I get like 4 thousand results back. How can I tell it to just return the last attemptdate?
> > select userid,attemptdate from logintracking
> > where userid = 'SMASSEY'
> >
> > I have to get the last attempt dates for all our user for an audit.
> > If I just run
> > select * from logintracking
> > it will return every login for all users and going thru all those for the last time they logged in would take me a while.
> > So I hope ya can help me out.
> >
> > Maximo 6.2.1
> > SQL Server 2005
> >
> > thx,
> > mrggutz
> >
> >
>
>
>
>


From: George (2012-03-09 17:59)

That worked great thank you very much.
--- In MAXIMO@yahoogroups.com, "Travis Herron" <therron@...> wrote:
>
> Try this:
>
> SELECT userid, MAX(attemptdate)
> FROM logintracking
> GROUP BY userid
> ORDER BY userid
>
>
> (that last line -- ORDER BY -- is optional; you can sort it or not sort it however you wish)
>
> Travis Herron
>
> --- In MAXIMO@yahoogroups.com, Chris Lawless <lawlessc@> wrote:
> >
> > Google HAVING MAX(ATTEMPTDATE)
> >
> > :)
> >
> > Chris.
> >
> > On Mar 8, 2012, at 8:35 PM, "George" <ggutierrez@> wrote:
> >
> > > Ok everyone I need a little help with SQL stuff.
> > > If you look below I have the following query to return for a certain user, but when I execute it I get like 4 thousand results back. How can I tell it to just return the last attemptdate?
> > > select userid,attemptdate from logintracking
> > > where userid = 'SMASSEY'
> > >
> > > I have to get the last attempt dates for all our user for an audit.
> > > If I just run
> > > select * from logintracking
> > > it will return every login for all users and going thru all those for the last time they logged in would take me a while.
> > > So I hope ya can help me out.
> > >
> > > Maximo 6.2.1
> > > SQL Server 2005
> > >
> > > thx,
> > > mrggutz
> > >
> > >
> >
> >
> >
> >
>