Sql查询出现次数 [英] Sql query number of occurrence
本文介绍了Sql查询出现次数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想查询:
Select cars.* from cars where cars.code in
(
select carCode from articles where
numberofrecords with this car (it is not a column) >1
and Accepted=1
order by date
)
怎么写?
推荐答案
应该这样做:
SELECT c.*
FROM cars c
JOIN
(
SELECT carCode
FROM articles
WHERE Accepted = 1
GROUP BY carCode
HAVING COUNT(carCode) > 1
) a ON c.code = a.carCode
这篇关于Sql查询出现次数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文