select * from blob_table where id IN ( select blob_id from attribute_table where attribute='color' and value='red );