If you need to get only those two columns, you can use the MAX (or MIN or another aggregate function) as shown below. If you needed to get other columns, we will have to use a different approach:SELECT customerid,
--item,
MAX(transactiondt) AS max_transactiondt
FROM transactions
WHERE item IN (10014623, 10014653, 10014637, 10014624, 10014641)
GROUP BY
customerid
ORDER BY
customerid,
max_transactiondt