select DISTINCT monitoring_stations."管道",count(0) as 数量
FROM monitoring_stations,monitoring_parameters
WHERE monitoring_stations."名称"=monitoring_parameters."名称" and monitoring_parameters."参数类型" like '%温度%'
GROUP BY monitoring_stations."管道" HAVING count(monitoring_stations."管道")>0
这里使用了大量的方法,模糊查询,distinct;
使用distinct会大大提高查询速度;
>0可以根据你的需求改为>1只得到超过一个相同数据的相关信息

本文探讨了SQL中使用模糊查询和DISTINCT关键字的方法,通过实例展示了如何结合这两个技术来提高查询效率,特别是当需要从大量数据中筛选特定类型的数据时。DISTINCT的使用可以显著减少重复数据,提升查询速度。
628

被折叠的 条评论
为什么被折叠?



