在存储过程中需要帮助 [英] Need help with a Stored Procedure

查看:107
本文介绍了在存储过程中需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我需要制作一个存储过程,该存储过程在以下情况下返回Employee ID的列表:
我有一个包含以下列的表格:
* EmployeeId * LeaveFromDate * LeaveToDate

我需要一个Proc,它将返回其休假日期范围"彼此相交的EmployeeId的集合.

例如,如果EmployeeId = 1从4月4日至4月7日请假
并且EmployeeId = 4从4月6日至4月8日请假
那么我的proc应该向我返回值1,4.

请帮忙!
问候
Lakshay Dulani

Hello everyone,
I need to make a stored procedure which returns the list of Employee Ids in the following scenario:
I have a table with following columns:
*EmployeeId *LeaveFromDate *LeaveToDate

I need a Proc which will return the collection of EmployeeId whose Leave Date Range intersect with each other.

e.g If EmployeeId = 1 has leave from 4 April to 7 April
and EmployeeId = 4 has leave from 6 April to 8 April
then my proc should return values 1,4 to me.

Please help!!
Regards
Lakshay Dulani

推荐答案

亲爱的朋友,

我认为以下查询将为您工作:-

Dear Friend,

I think the following query will work for you:-

select EmployeeId from Employee where LeaveFromDate between @FromDate and @ToDate



其中@FromDate是4月4日,@ ToDate是4月7日.

将上述查询添加到您创建的存储过程中.

谢谢



where @FromDate is 4 Apriland @ToDate is 7 April in your case.

Add the above query in the stored proc you make.

Thanks


这篇关于在存储过程中需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆