Announcement

Collapse
No announcement yet.

Help please...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help please...

    I am making a who's online style page for my site but I am stuck. My usersonline table has 3 fields :

    timestamp,
    ip,
    location

    The thing is I want it to show distinct IPs, but I want to display the location with each of those.

    I tried :

    SELECT DISTINCT ip, location FROM usersonline

    But I got a list of ALL the ips

    How can I do this?

    Thanks in advance,

    Matt

  • #2
    Is there no-one who can do this? I have tried on about 50 forums and nobody seems to have a way that I can do it.

    Comment


    • #3
      select count(ip) AS hits, location from table GROUP BY ip

      Comment


      • #4
        Originally posted by scoutt
        select count(ip) AS hits, location from table GROUP BY ip
        Thank you!

        Works like a dream

        Comment


        • #5
          SELECT DISTINCT ip, location FROM usersonline

          should work o_0

          Comment


          • #6
            no, because it all depends on what version they are using as to how distinct works.

            in version 3.23 you had to have group by or order by in it for it to work.

            so you could do something like this

            SELECT DISTINCT ip, location FROM usersonline GROUP BY ip

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...
            X