fix addiing duplicate PK attributes in select query