Home > database >  According to the group 8 to 20 points on the day of the data, finally a data query grouping, check o
According to the group 8 to 20 points on the day of the data, finally a data query grouping, check o

Time:03-20

Is to query data from 8 PM to 8 PM in the day, according to the PN group, to take the current group at the end of the article 1 data,
Out is empty, there are data during the day, night is empty of statements,
Is related to these two lines of code below?
The time BETWEEN '08:00:00' and '19:59:59'
AND
Assemble_tab. Date=the convert (varchar (10), getdate (), 120)
But the date is the date inside ah, have no time, time is a time field,

The code is as follows:

SELECT
Datetime as date,
Time as the time,
Project_name as project name,
[Date] as Date,
Don't class_type as classes,
PN as material,
Standard_Production as standard capacity,
Actual_Capacity as actual capacity,
Undesirable_Reason_1 as float switch,
Undesirable_Reason_2 as other bad,
Undesirable_Reason_3 as impurities,
Undesirable_Reason_4 as plastic pieces of dirt,
Undesirable_Reason_5 as glue smudgy,
Undesirable_Reason_6 as glue damage
The FROM Assemble_tab
WHERE
Pn!=0
AND
The time BETWEEN '08:00:00' and '19:59:59'
AND
Assemble_tab. Date=the convert (varchar (10), getdate (), 120)
And
Time (in
SELECT
MAX (time) FROM Assemble_tab GROUP BY PN
)


Database diagram below

  • Related