使用这个查询,我得到了我想要的数据。
select *
from tbl_project
join tbl_project_detail on tbl_project_detail.project_id = tbl_project.id
我需要知道如何在 Linq-to-SQL 中使用此 SQL:
select SUM(pd.no_vacancy) as Number
from tbl_project p
join tbl_project_detail pd on pd.project_id = p.id
where p.id='1'
我也尝试过,但它不起作用。
var result = (from p in db.tbl_projects
join c in db.tbl_project_details on p.id equals c.project_id
where c.project_id == type
select new { c.no_vacancy }).Sum();
请帮帮我..我被卡住了:(