SQL inner join usage

1.

select time_trees.id,name,lft,rgt,parent_id,project_id,SUM(wEnd)-sum(wBegin) as wEnd from time_trees inner join work_items on work_items.project_id = time_trees.original_id and work_items.dayinfo_id = '00c60267c36301e4-05-00000000000065' group by work_items.project_id

2.

"select time_trees.id,name,lft,rgt,parent_id,task_id,SUM(wEnd)-sum(wBegin) as wBegin from time_trees inner join work_items on work_items.task_id = time_trees.original_id and work_items.dayinfo_id = '" + @day_info.original_id.to_s + "' group by work_items.task_id"

你可能感兴趣的:(sql)