SQL中如何统计查询结果中某一列重复值的个数? 将这几个连接的表表示为表a,再写一个表b,与表a一样,查出fsu_device_id以及出现的次数,然后a与b连接,a表左连接b表,查出最终结果大体思路就是这样,以下SQL我没有验证,如果有执行错误,自己稍作修改即可SELECT a.fsu_device_id,b.times,a.device_id,a.device_name,a.model_name,a.mete_code,a.mete_nameFROM(SELECT md.fsu_device_id,md.device_id,de.device_name,mm.model_name,ml.mete_code,ml.mete_nameFROM t_cfg_monitordevice mdINNER JOIN t_cfg_device deON md.device_id=de.device_idINNER JOIN t_cfg_metemodel mmON de.device_model=mm.model_idINNER JOIN t_cfg_metemodel_detail mlON mm.model_id=ml.model_id)aleft join(SELECT md.fsu_device_id,count(*)timesFROM t_cfg_monitordevice mdINNER JOIN t_cfg_device deON md.device_id=de.device_idINNER JOIN t_cfg_metemodel mmON de.device_model=mm.model_idINNER JOIN t_cfg_metemodel_detail mlON mm.model_id=ml.model_idgroup by md.fsu_device_id)bon a.fsu_device_id=b.fsu_device_idORDER BY a.fsu_device_id ASC
sql查询语句计算重复数据个数 DISTINCT 是去重复值。select count(mypage)as s from deyebcount group by mypage order by mypage desc;
sql查询语句计算重复数据个数 查询重复数据的话直接selectfromtable_name;就可以了啊如果是想剔除有重复的数据,selectdistinctfromtable;