大家好,我收到这个错误“找不到column2”我想把两个查询合并在一个数据库中插入数据一切都很完美,但我不知道为什么会出现这种类型的错误,我不知道如何解决请帮助我谢谢
Here is my code:
string sqlCust21 = "SELECT Name,sum(CAST(ubl As int)) FROM payment WHERE dates <= '" + dateTimePicker1.Text + "' Group By union SELECT Name,sum(CAST(ubl As int)) FROM payment WHERE dates > '" + dateTimePicker2.Text + "' Group By Name";
DataAccess.ExecuteSQL(sqlCust21);
DataTable dtCust21 = DataAccess.GetDataTable(sqlCust21);
MessageBox.Show(dtCust21.Rows[0][2].ToString());
2条答案
按热度按时间9udxz4iz1#
后面缺少列名
GROUP BY
.hzbexzde2#
datarowcollections基于0。试试这个