The given SQL query is not valid. The correct query is as follows: \n\nSELECT PlayerId, itemcfg.ItemType, SUM(Count) as item_SUM \nFROM item \nLEFT JOIN itemcfg ON itemcfg.Id = item.ItemCfgId \nWHERE 1=1 \nGROUP BY PlayerId, ItemType \nHAVING \n CASE \n WHEN itemcfg.ItemType = 0 THEN item_SUM >= 50\n ELSE NULL\n END\nORDER BY item_SUM DESC

SQL Query Optimization: Correcting a SELECT Statement with CASE and GROUP BY

原文地址: https://www.cveoy.top/t/topic/qdqx 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录