MS Access布尔验证规则。检查两个不同表中的值

时间:2017-07-12 12:24:36

标签: sql ms-access

我有两个表:参数和测量。 这是参数表:

     Param_id   Lspec   Uspec   LCL   UCL
         1       4.2     5.2    4.3   4.9
         2       3.2     4.2    3.3   3.8
         3       4.2     5.2    4.3   4.9

这是测量表:

     Param_id   Value  Passed
         1       4.4    T/F
         2       3.5    T/F
         3       4.2    T/F

对于布尔列'通过'我需要验证规则,这在以下情况下是正确的:

  • (Lspec< = Value< = Uspec& LCL< = Value< = UCL)

如何创建此类验证规则?

1 个答案:

答案 0 :(得分:0)

您可以使用此查询:

Select 
    Parameter.*,
    Measurement.*,
    (Lspec <= [Value] And [Value] <= Uspec And LCL <= [Value] And [Value] <= UCL) As Passed
From
    Parameter.*
Inner Join
    Measurement
    On (Parameter.Param_id = Measurement.Param_id)
相关问题