how to get even number ids and without duplicates in sql code example Example: sql exclude duplicates and find even id SELECT DISTINCT city FROM tablename WHERE id % 2 = 0