MySQL Forums
Forum List  »  Newbie

Re: Distinct Query Help
Posted by: scott kimler
Date: June 07, 2005 03:36PM

Felix,

Thank you for responding. It's difficult to believe that I've been at this all day, but your link helped me to determine the correct query.

(Unbeknownst to me, my host isn't running the latest version of MySQL (4.1), because it is currently unsupported by cPanel (?) So the subquery option was not available to me. I chased my tail around on that for a while, but fortunately, your link covers earlier versions as well.)

Running in a PHP environment, my solution looks like this:


mysql_query('create temporary table evo_onlineTemp ( ip varchar(40), timestamp integer(15), primary key (timestamp), index(ip) )');
mysql_query('insert into evo_onlineTemp (ip,timestamp) select ip, max(timestamp) from evo_online group by ip');
$getEM = mysql_query('select evo_online.ip, file, totIP, evo_online.timestamp from evo_online, evo_onlineTemp where evo_online.ip=evo_onlineTemp.ip and evo_online.timestamp=evo_onlineTemp.timestamp');

Thank you so much for the link. It was EXACTLY what the doctor ordered.

(Now ... all I need to do is determine the maximum number of characters for the "file" field, contained in the result, so I can set the window size accordingly. If it's not one thing, it's something else, eh?) Learning in a vaccuum is difficult!

Thanks again for your help.

Cheers,

Scott

Options: ReplyQuote


Subject
Written By
Posted
June 07, 2005 10:31AM
Re: Distinct Query Help
June 07, 2005 03:36PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.