Fixed ChEMBL SQL query and non-redundant dataset generation