Hi. I want to normalize my vales coming from where caluse. I have an SQL table and it has 3 columns and 200k+ rows. Normalize formula: ((Value / Maximum Value) * 100). I coded it like that;
string myQuery = "select c1, c2, c3 / m.max_c3 * 100 normalizedvalue from myTable inner join (select convert(float, max(c3)) c3 from myTable) m on 1 = 1 WHERE c1='" + sr[mssi1] + "' AND c2='" + sr[mssi2] + "' OR c2='" + sr[mssi1] + "' AND c1='" + sr[mssi2] + "'";
Actually it works but it's not what I want. Because it selects maximum value from myTable's maximum value. But I want to select maximum value according to where clauses results. Should I use over () or something else? Thank you.