如何选择sum(max remain(x + y + z)) from
MySQL,来捕捉sum(1200+1300+1400)
?
id | user | remain
-----------------
1 | x | 1000
----------------
2 | x | 1200
----------------
3 | y | 1100
----------------
4 | y | 1300
----------------
5 | z | 1200
----------------
5 | z | 1400
----------------
using (SqlConnection cn = new SqlConnection(Class1.x))
{
cn.Open();
string cm1 = "select sum(max remain(all users)) as 'total' from item_new_company";
using (SqlCommand cmd = new SqlCommand(cm1, cn))
{
using (SqlDataReader dr = cmd.ExecuteReader())
{ dr.Read(); tot5 = dr["total"].ToString(); }
}
}