SQL技巧

//查询表中某一字段出现的次数

SELECT question ,COUNT(*) as 次数 FROM QuestionBankSelect GROUP BY question 

//查询表中多个字段多次出现的记录

select * from QuestionBankSelect t where (select count(1) from QuestionBankSelect 

where question=t.question and option1=t.option1 and option2=option2 and option3=t.option3 and option4=t.option4 and inUse=1 and t.inUse=1)>1

原文地址:https://www.cnblogs.com/wangchengb/p/10571191.html