Select only the last record for multiple values
give your example data this should do it.

SELECT name, max(f_time) AS f_time
FROM sessions 
WHERE name IN ('abc','def','xyz') 
GROUP BY name 
ORDER BY name;


If you need to pick the f_time according to some other column it gets messy.

In Postgresql you can use the distinct on SQL extension.

SELECT DISTNICT ON (name)
    name, f_time
FROM sessions 
WHERE name IN ('abc','def','xyz') 
ORDER BY name, id desc;


i think there's also a way using window functions