任何人都可以帮我修改下面的子查询到Join Condition中,这样我们就可以提高脚本的性能
var title = $("#event-title").val(),
duration = $("#event-title").find("option:selected").data('duration');
var newDurationDate = moment(start.format('YYYY-MM-DD')+' '+duration+':00');
var durationInMinutes = (newDurationDate.hour()*60)+newDurationDate.minute());
//Overwrite value of end
end = moment(start).add(durationInMinutes, 'minutes');
console.log(endDate.format('YYYY-MM-DD HH:mm'));
if (end) {
//Returns ex: Mon Jan 11 2016 09:35:00 GMT+0000
.........
答案 0 :(得分:0)
from #Head hw
join NExclusion on NExclusion.centercode = hw.bucketcode
join Employee et on hw.EmployeeCode = et.EmployeeCode
join Bonus b on hw.BonusId = b.BonusId
join Expense pr on pr.CompanyId = @CompanyId and pr.ModuleId = b.ModuleId
Where hw.BucketId = @BucketId and et.BonusFlag = 1 and b.CompanyId = @CompanyId and et.EmployeeCode <> 'h'
我做了以下更改:
1)将所有条件移至where where子句后的最后一个地方
2)Sql不区分大小写,因此您不需要将EmployeeCode转换为大写并进行比较,我已将其删除以降低此性能开销。
3)更改IN条件以加入。
4)删除了与Bonus表的重复连接