select osmid,ST_X(shape),ST_Y(shape)
from osmpoints
where (osmpoints.osmid, osmpoints.osmtimestamp)
IN (select osmid,MAX(osmtimestamp)
from osmPoints
GROUP BY osmid
Having MAX(osmtimestamp) <= '2019-09-16T01:23:55Z'
AND osmid in ('4426786454','1861591896','1861591869','1861591895',
'4426786455','2038185115','1861591853','6797739995',
'2299605892','6797739994','1861591898','2038185111','4426786454'));
when I run this query, I get sorted rows based on osmid column. but my question is how can I get rows in order of osmid that use in the IN clause?