Method for getting only primary keys