| |

VerySource

 Forgot password?
 Register
Search
View: 656|Reply: 3

The couple ask for a few sentences

[Copy link]

1

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-7 09:30:01
| Show all posts |Read mode
There is a table to record the working hours of all employees per day. Now all we have to do is add up each person's overtime working hours per day to more than 36 hours per month. Those who exceed 36 * 12 each year are displayed.
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-7 12:06:01
| Show all posts
select
   Employee,
   left (year, month, 4) as year,
   sum (overtime work) as overtime work
from
   (
   select
       Employee,
       convert (varchar (7), date, 120) as month
       sum (overtime work) as overtime work
   from
       table
   group by
       Employee,
       convert (varchar (7), date, 120)
   having
       sum (overtime work)> 36
   ) as t

group by
   Employee,
   left (year, month, 4)
having
   sum (overtime work)> 36 * 12
Reply

Use magic Report

1

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

 Author| Post time: 2020-1-7 13:30:02
| Show all posts
Thank you upstairs. I just started learning SQL. I have to learn more from you.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-8 01:09:01
| Show all posts
Yes, learned
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list