如何在SQL Server中保存今年的记录 [英] How to save record of this year in sql server

查看:119
本文介绍了如何在SQL Server中保存今年的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,
我正在使用请假管理系统.在此,我想保留员工的年度记录,所以我想知道如何每年保存员工的记录..我正在使用sql server ..
请为我提供想法..

Hello Friends,
i am working on Leave Management System.In this i want to kept yearly records of the employee so i want to know how to save record of employee yearly ..i am using sql server ..
pls provide me ideas..

推荐答案

设置两个表:Employees和Leave.请假表有一个与员工有关的外键.
每次员工请假时,请在请假"表中记录员工的开始日期,请假年份以及所涉及的工作日数(如果公司允许,请输入半天). (请假年是因为很少有公司请假时间从1月1日开始-许多公司从4月开始)

然后,您只能返回雇员的相关记录,并在适当的时期内根据需要进行过滤和排序.
Set up two tables: Employees and Leave. The Leave table has a foreign key which is the Employee concerned.
Each time the Employee takes leave, record the start date, leave year, and the number of working days involved (or half days if your company allows that) against the Employee in the Leave table. (The leave year is because few companies leave period runs from January 1st - many start in April)

You can then return only the relevant records for an employee, filtered and sorted as necessary for the appropriate periods.


select * from Tablename where ColumnName>='01-jan-2011'
and ColumnName<='31-dec-2011'


这篇关于如何在SQL Server中保存今年的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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