You are here: Re: Mysql Query Question « PHP SQL « IT news, forums, messages
Re: Mysql Query Question

Posted by J.O. Aho on 11/20/06 09:12

flouger@gmail.com wrote:
> Im trying to write the following query to do the following but im not
> sure about the right way to do it
>
> I want to get back all the results minus any results that are within
> the 3 minutes of each other containing the same ip address, and same
> owner information.
>
> Basicly I want to filter out multiple entries with different times.
>
> the database looks like this.
> `owner` int(11) NOT NULL default '0',
> `visitor` int(11) NOT NULL default '0',
> `visittime` timestamp(14) NOT NULL,
> `ip` varchar(16) NOT NULL default ''
>
> I Imagine I need to use a time diff function but am not really sure how
> to implement that in.

I would make a sql function/procedure that takes visittime to a time with 3
mins steps

http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html

Then you apply that to the visittime column and make a DISTINCT select and you
should get quite close to what you had in mind.


//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация