获取某个ID在其他列表中相同otherid 的总和

获取某个ID在其他列表中相同otherid_的总和


获取某个ID在其他列表中相同otherid_的总和






                textBox1.Text = "0";  ///  先设置默认值


                SqlConnection conn8888 = new SqlConnection("server=2PNT8Q4Y5OJ0DP0\\SQLEXPRESS;uid=sa;pwd=****;database=ydgl;Max Pool Size = 512;");
                conn8888.Open();
                SqlCommand mycmd = new SqlCommand("select sum(sl) from cg  where  (yaoid = '" + textBox5 .Text + "') and  (cgrq between '" + textBox4.Text + "' AND '" + textBox6.Text + "') ", conn8888);
                this.textBox1.Text = mycmd.ExecuteScalar().ToString();


winform代码