你试一下 那个count后面跟的应该是group by后面跟的一样select a.lessonId from tb_Questions a,tb_Questions bwhere a.type='单选题' group by a.lessonId having count(a.lessonId )>=2 不过我感觉 你这个句子表达的就不对 你是不是想找出a b中都满足你提条件的 展开
你试一下 那个count后面跟的应该是group by后面跟的一样select a.lessonId from tb_Questions a,tb_Questions bwhere a.type='单选题' group by a.lessonId having count(a.lessonId )>=2 不过我感觉 你这个句子表达的就不对 你是不是想找出a b中都满足你提条件的项 不需要在写两个where句子 你这样试一下select a.lessonId, b.lessonId from tb_Questions a,tb_Questions bwhere a.type='单选题' or b.type='多选题' group by a.lessonId,b.lessonIdhaving count(a.lessonId)>=2 and count(b.lessonId )>=2 收起