"Joanne Pham" <[email protected]>
wrote in message news:[email protected]
> 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
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to