Re: do not display dublicated entries
| From: | septic | Date: | Wed, 14 Mar 2007 06:41:44 +0000 |
| Subject: | Re: do not display dublicated entries | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-43280@lists.php.net to get a copy of this message | ||
Thanks for the responce..
I have tried everything except of the one that forms the date in one field
and use the DISTINCT for ip and date.
The problem with the distinct is that even if I use 'order by' the entries I
get for all IPs are not the latest ones that exist in the database.
.
""septic"" <nrasidakis@hotmail.com> wrote in message
news:69.12.18628.6B717F54@pb1.pair.com...
> Hello all,
>
> I have created a simple webtracer for my website and I save some info on
> mysql database.
>
> table = tracker
>
> FIELDS
> ip
> day
> month
> year
> session_id
> browser of visitor
> page that was visited
>
>
> What I would like to do next, is simple to create an output of that
> database with the last time that every different IP has visited my
> website.
>
> the best output I have at the moment is:
>
> $query = "SELECT ip,day,month,year FROM tracker WHERE page = 'index'
> ORDER BY
tracker.year DESC ,
> tracker.month DESC ,
> tracker.day
> DESC LIMIT 0,20 ";
>
> The problem is that I want to Keep for each different IP the fisrt entry
> that is found on this output I get.
>
> therefore I would say that the output would represent the last visit of
> each different user on my website.
>
> do you know of a php or sql trick to avoid entries that containt the same
> IP entries ?
>
> Thanks in advance for the help.
> Nikos.