Home > database >  How SQL server work according to the employees' attendance record and table of the employee tab
How SQL server work according to the employees' attendance record and table of the employee tab

Time:11-14

Now have two tables, a a table for the staff table, a table b records for work, as long as the b table to generate data means that the employee attendance, now according to user input and input in the two periods to control the scope of the query, and need to display 1-31 whether to go to work, if there is a time in the morning has a record of work, but not in the afternoon, that even if you don't have to go to work, want to ask is according to month, from 1 to 31 and judgment of the two periods. What should I write?
The user to enter data as shown in figure

CodePudding user response:

Suggested to build the number of days a month, such as the temporary table, then the associated time sheets, table, through the case the when time to determine whether a clock in time in the input range, if the two time range meet the elucidation is normal work, didn't go to work or display

CodePudding user response:

As described above, 1/f, building temporary table structure below

In order to conform to the habits of the people, and then translate the relation, become abscissa titled 1-31 time sheets,

CodePudding user response:

refer to the second floor Jiang Haiqing peng reply:
as described above, 1/f, building temporary table structure below

In order to conform to the habits of the people, and then translate the relation, become abscissa titled 1-31 time sheets,
this is to write a stored procedure, can also use the method of temporary table?
  • Related