SELECT
LabLotTest.LabID,
Instrument.Name,
LabLotTest.LotID,
Analyte.Name,
Analyte.AnalyteID,
Unit.Name,
Method.Name,
Reagent.Name,
Temperature.Name,
PointData.EnteredDate,
PointData.Operator,
PointData.Level1Value,
PointData.Level1Violation,
PointData.Level1Status,
PointData.Level2Value,
PointData.Level2Violation,
PointData.Level2Status,
PointData.Level3Value,
PointData.Level3Violation,
PointData.Level3Status,
PointData.Level4Value,
PointData.Level4Violation,
PointData.ActionLog,
PointData.Comment,
PointData.RuleApplied,
PointData.FloatMeanSD,
PointData.FixedMeanSD
FROM
PointData,
LabLotTest,
Test,
Analyte,
Instrument,
Method,
Reagent,
Temperature,
Unit
WHERE
( PointData.LabLotTestID = LabLotTest.LabLotTestID )
AND ( Test.TestID = LabLotTest.TestID )
AND ( Test.AnalyteID = Analyte.AnalyteID )
AND ( Test.InstrumentID = Instrument.InstrumentID )
AND ( Test.MethodID = Method.MethodID )
AND ( Test.ReagentID = Reagent.ReagentID )
AND ( Test.TemperatureID = Temperature.TemperatureID )
AND ( Test.UnitID = Unit.UnitID )
AND (
( PointData.Level1Violation <> '' and PointData.Level1Status = 0)
OR ( PointData.Level2Violation <> '' and PointData.Level2Status = 0)
OR ( PointData.Level3Violation <> '' and PointData.Level3Status = 0)
OR ( PointData.Level4Violation <> '' and PointData.Level4Status = 0)
)
AND PointData.EnteredDate > = '2021-07-19'
AND PointData.EnteredDate < = '2021-07-19 23:59:59'
and LabLotTest.LabID in (232017)