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

posted @ 2019-03-21 13:49  民院小青年  阅读(109)  评论(0)    收藏  举报