select spepmenu_main.id from speppower,spepmenu_main where speppower.menuid=spepmenu_main.id and upper(speppower.account)='{0}'and speppower.power_status='1' order by speppower.account
你还在转这些SQL啊.....可怜的孩子
string account=XXX.ToUpper();
var result=from s in spepmenu_main
where s.account.ToUpper()==account && s.power_status='1'
join v in speppower
on s.id eques v.menuid
order by s.account
select s.id
o(︶︿︶)o
为什么会有个join?
直接把 on s.id eques v.menuid
放到上面的 where 里面 不行吗?
@许大虾: 因为是多表查询
不过可以试试这么写:
var result=from s in spepmenu_main
from v in speppower
where s.account.ToUpper()==account && s.power_status='1'
&& s.id == v.menuid
order by s.account
select s.id
@hailants: 上面这两种好像最后都会报一个 找不到 列Id的错
@许大虾: 楼下说的对,我少打了括号
select s.id 应该改为select new{s.id};