我试图在我的sql表中找到重复的条目,我通过以下查询很容易实现它。
SELECT * FROM sds_bank_phrases INNER JOIN (Select bank_statement FROM sds_bank_phrases GROUP BY bank_statement HAVING COUNT(bank_statement) > 1) dup ON sds_bank_phrases.bank_statement = dup.bank_statement;
数据库表
答案 0 :(得分:1)
您可以使用TRIM(TRAILING'。'FROM your_column);
SELECT *
FROM sds_bank_phrases
INNER JOIN (Select TRIM( TRAILING '.' FROM bank_statement ) as clean_bank_statement
FROM sds_bank_phrases GROUP BY bank_statement HAVING COUNT(TRIM( TRAILING '.' FROM bank_statement )) > 1) dup
ON TRIM( TRAILING '.' FROM sds_bank_phrases.bank_statement ) = dup.clean_bank_statement;