"Joanne Pham" <joannekp...@yahoo.com>
wrote in message news:936179.87380...@web90307.mail.mud.yahoo.com
> I have the folowing table which has the following data for example:
> remoteId hostName lastUpdateTime ....
>
> So if I ran this statement below:
> select * from table group by hostName having count(*) > 1;
> I got the following rows:
> 2 host1 111111
> 6 host4 444444
>
> But I want the rows which have bigger lastUpdateTime if hostName has
> duplicate row.

select * from myTable t1 where lastUpdateTime =
(select max(lastUpdateTime) from myTable t2
 where t1.hostName = t2.hostName
 group by t2.hostName having count(*) > 1);

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to