For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > March 2007 > Re: [PHP-DB] Re: do not display dublicated entries









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] Re: do not display dublicated entries
Micah Stevens

2007-03-14, 4:00 am

I thought about this some more, and my last reply wouldn't work if you
wanted data besides the IP and date. A better answer is to use a
self-join like this:

select t1.* from tracker t1
left join tracker t2 on t2.date > t1.date
and t2.ip = t1.ip
where t2.date is null

That should get you what you want.

-Micah

On 03/13/2007 11:41 PM, septic wrote:
> 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...
>
>
>


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com