赞
踩
现在有这样一条需求:
求本年度内入职员工的平均工资
核心点: 本年度内的员工的平均工资,如果是今年以前入职的查询今年的 如果是今年入职的查询今年入职的平均工资。
- create database Users
- go
- Users
-
- go
-
- create table MyUser(
- Id int primary key identity(1,1),
- Name nvarchar(50),
- Years nvarchar(50),
- Salary int
- )
- insert into MyUser values('张三','2019-01',100)
- insert into MyUser values('张三','2019-02',100)
- insert into MyUser values('张三','2019-03',100)
- insert into MyUser values('张三','2019-04',100)
- insert into MyUser values('张三','2019-05',100)
- insert into MyUser values('张三','2019-06',100)
- insert into MyUser values('张三','2019-07',100)
- insert into MyUser values('张三','2019-08',100)
- insert into MyUser values('张三','2019-09',100)
- go
- insert into MyUser values('李四','2019-07',100)
- insert into MyUser values('李四','2019-08',100)
- insert into MyUse
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。