select afai.districtcode code,
count(afai.alarm_type = '2' or null ) forest_alarm,
count(afai.alarm_type = '1' or null ) non_forest_alarm,
count(afai.fire_type = '2' or null ) forest_fire,
count(afai.fire_type = '1' or null ) non_forest_fire,
afai.source_name district
from enbogis.bis_all_fire_alarm_index afai
WHERE 1=1
and source_lon is not null and source_lat is not null and fire_lon is not null and fire_lat is not NULL
group by afai.districtcode
having forest_fire>0 or non_forest_fire>0 or forest_alarm>0 or non_forest_alarm>0
错误信息
SQL 错误 [42803]: 错误: 字段 "afai.source_name" 必须出现在 GROUP BY 子句中或者在聚合函数中使用
Position: 285 At Line: 6, Line Position: 9
之前从mysql迁移到金仓数据库,数据迁移完成后,该后端的代码,就出现上面的错误按照提示修改过后确发现与原sql查询出来的数据不一样
修改过后的金仓sql多了很多条数据 不知道怎么办才好 希望各位帮帮我 钛痛苦了!!