I want to select only the latest membership_id from table user_payments of the user with the user_id equal to 1.
This is how the table user_payment looks like:
SELECT p.MEMBSHIP_ID FROM user_payments as p WHERE USER_ID = 1 AND PAYM_DATE = ( SELECT MAX(p2.PAYM_DATE) FROM user_payments as p2 WHERE p2.USER_ID = p.USER_ID )