मैं अपने मामले बयान के अंदर कुछ गणना जोड़ने के लिए गतिशील रूप से एक नया स्तंभ की सामग्री बनाना चाहते हैं, लेकिन मैं त्रुटि मिलती है:एसक्यूएल सर्वर में एक मामला बयान के अंदर एक SUM() कैसे करना है
Column 'Test1.qrank' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
यह वह कोड है जिसे मैं
case
when test1.TotalType = 'Average' then Test2.avgscore
when test1.TotalType = 'PercentOfTot' then (cnt/SUM(test1.qrank))
else cnt
end as displayscore
मैंने समूह करने का प्रयास किया लेकिन यह काम नहीं किया।
कोई संकेत?
आपकी शेष क्वेरी क्या है। यदि आप ग्रुप बाय ... –