Re: Re: do not display dublicated entries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/14/07, Niel Archer <spamfree@xxxxxxxxxxxxxxxx> wrote:
Hi

> I have tried everything except of the one that forms the date in one field
> and use the DISTINCT for ip and date.

It works for me. I use it for essentially the same job, listing most
recent visit to a location (not IP, but physical venue).

Have you tried adapting it to your needs, such as:
$query = "SELECT DISTINCT ip, day, month, year FROM tracker WHERE page = 'index'  ORDER
BY `tracker`.`year` DESC , `tracker`.`month` DESC , `tracker`.`day` DESC LIMIT 0, 20";


Niel

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



try grouping by IP and selecting the max date value
SELECT IP,max(date) AS latestvisit FROM table GROUP BY IP

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux