日期:2014-05-18  浏览次数:20420 次

sql 语句问题,感谢大家
string   sql   =   "select   *   from   userlist   where   username   =   ' "   +   this.txtname.Text   +   " '   and   ppassword   =   ' "   +   this.txtpwd.Text   +   " '   and   usertype   =   ' "+this.ddlsubschoolname.Text+ " ' ";

string   sss   =   "     select   sum(cast(c.ischeck     as       tinyint))as   summ   ,count   (*)   as   countt         from   roleright   a   inner   join   RoleRight   b   ON   A.Funname   =   '工作安排 '   AND   b.FunListType   =   A.FunId     inner   join   usertypefun   c   on   c.funid   =   a.funid   and   c.usertype   =   ' "   +   Session[ "branch "].ToString()+ " ' ";

其中Session[ "branch "].ToString()是前一个查询语句中的usertype
怎么把这两条语句变为一条语句。




------解决方案--------------------
string sss = " select sum(cast(c.ischeck as tinyint))as summ ,count (*) as countt from roleright a inner join RoleRight b ON A.Funname = '工作安排 ' AND b.FunListType = A.FunId inner join usertypefun c on c.funid = a.funid and c.usertype = ' "+this.ddlsubschoolname.Text+ " ' ";