2 u013710777 u013710777 于 2014.04.02 14:58 提问

sql语句的深层次的使用

恩,能不能把以下的内容用一条sql语句表达???
string str = "select distinct sho_id from view_ocs";
DataSet list_id = o.Select(str);
int all = list_id.Tables[0].Rows.Count;
for (int i = 0; all > i;i++)
{
int sho_id = Convert.ToInt32(list_id.Tables[0].Rows[i][0].ToString());
string strt = "select avg(nullif(ord_sendtime,0)) as ord_averagetime from (select top (50) * from view_ocs where sho_id=@p0 order by ord_id desc)tmp; ";
DataSet list_time = o.Select(strt,sho_id);

            int ord_averagetime = Convert.ToInt32(list_time.Tables[0].Rows[0][0].ToString());
            string up = "update shop set sho_arrivetime=@p0 where sho_id=@p1";
            bool flag = o.Handle(up,ord_averagetime,sho_id);
        }

1个回答

ZR__MaNong
ZR__MaNong   2014.12.26 10:29

说明叫用一条 sql表达?

Csdn user default icon
上传中...
上传图片
插入图片