help with an SQL....

help with an SQL....

am 17.08.2005 14:59:25 von Mark Mchugh

Hi,
Hope somebody can help. I have a userlog table, and in
the table i have the following fields

id, userid,usertype,eventdate,useraction

so, i want to grab out the userid for the top 10 user
where useraction = login

can this be done with 1 sql statement?

thanks

MArk



__________________________________
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html


--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org

RE: help with an SQL....

am 17.08.2005 15:03:25 von paulo.urcid

Mark, just to be on track with you... you want to know the 10 users who =
have
logged in the most? Is this correct? Or do you just want to know the =
last 10
users who logged in?

-----Mensaje original-----
De: Mark Mchugh [mailto:mark_mch@yahoo.com]=20
Enviado el: Mi=E9rcoles, 17 de Agosto de 2005 07:59 a.m.
Para: mysql list
Asunto: help with an SQL....

Hi,
Hope somebody can help. I have a userlog table, and in
the table i have the following fields

id, userid,usertype,eventdate,useraction

so, i want to grab out the userid for the top 10 user
where useraction =3D login

can this be done with 1 sql statement?

thanks

MArk


=09
__________________________________=20
Yahoo! Mail=20
Stay connected, organized, and protected. Take the tour:=20
http://tour.mail.yahoo.com/mailtour.html=20


--=20
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Durcid@vw.com.mx

--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dgcdmw-win32@m.gmane.org

RE: help with an SQL....

am 17.08.2005 15:11:30 von thompsgr

How about:

SELECT DISTINCT userid, Count(*) AS nbrLogins FROM userlog WHERE
useraction='login' GROUP BY userid ORDER BY nbrLogins DESC LIMIT 0,10

> -----Original Message-----
> From: Mark Mchugh [mailto:mark_mch@yahoo.com]
> Sent: Wednesday, August 17, 2005 7:59 AM
> To: mysql list
> Subject: help with an SQL....
>
> Hi,
> Hope somebody can help. I have a userlog table, and in
> the table i have the following fields
>
> id, userid,usertype,eventdate,useraction
>
> so, i want to grab out the userid for the top 10 user
> where useraction = login
>
> can this be done with 1 sql statement?
>
> thanks
>
> MArk
>
>
>
> __________________________________
> Yahoo! Mail
> Stay connected, organized, and protected. Take the tour:
> http://tour.mail.yahoo.com/mailtour.html
>
>
> --
> MySQL Windows Mailing List
> For list archives: http://lists.mysql.com/win32
> To unsubscribe: http://lists.mysql.com/win32?unsub=thompsgr@avaion.com




--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org

RE: help with an SQL....

am 17.08.2005 15:18:14 von Mark Mchugh

Thanks, Geoffrey, this seems to do the job!!!


Cheers

MArk

--- "Geoffrey R. Thompson"
wrote:

> How about:
>
> SELECT DISTINCT userid, Count(*) AS nbrLogins FROM
> userlog WHERE
> useraction='login' GROUP BY userid ORDER BY
> nbrLogins DESC LIMIT 0,10
>
> > -----Original Message-----
> > From: Mark Mchugh [mailto:mark_mch@yahoo.com]
> > Sent: Wednesday, August 17, 2005 7:59 AM
> > To: mysql list
> > Subject: help with an SQL....
> >
> > Hi,
> > Hope somebody can help. I have a userlog table,
> and in
> > the table i have the following fields
> >
> > id, userid,usertype,eventdate,useraction
> >
> > so, i want to grab out the userid for the top 10
> user
> > where useraction = login
> >
> > can this be done with 1 sql statement?
> >
> > thanks
> >
> > MArk
> >
> >
> >
> > __________________________________
> > Yahoo! Mail
> > Stay connected, organized, and protected. Take the
> tour:
> > http://tour.mail.yahoo.com/mailtour.html
> >
> >
> > --
> > MySQL Windows Mailing List
> > For list archives: http://lists.mysql.com/win32
> > To unsubscribe:
>
http://lists.mysql.com/win32?unsub=thompsgr@avaion.com
>
>
>
>


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org