所以我的数据看起来像这样:
Smpl_id Plate_id CT_Value
1 1 27
1 1 32
2 1 56
2 1 49
1 2 40
1 2 36
2 2 58
2 2 64
我想设计一个查询,该查询返回板中每个样本的CT_Value
平均值,因此它看起来像这样:
Smpl_id Plate_id Avg_CT
1 1 29.5
2 1 52.5
1 2 38
2 2 61
我尝试过
Avg_CT: DAvg("[CT_Value]","[qPCR_sample_data]","[Plate_id] = '" & [Plate_id] & "'" And "[Smpl_is] = '" & [Smpl_id] & "'")
但是那只会导致:
Smpl_id Plate_id CT_Value
1 1 45.25
1 1 45.25
2 1 45.25
2 1 45.25
1 2 45.25
1 2 45.25
2 2 45.25
2 2 45.25
我不能只列出板号或样品的ID号,因为这实际上是一长串,而且还在不断增长。我还需要在以后的计算中使用这些平均值(我已经弄清楚该怎么做)。
而且,我刚刚开始使用MS Access(设计一个全新的数据库),所以我有点理解SQL,但对它的实际经验很少。
谢谢!
您应该能够使用简单的聚合,例如:
select t.smpl_id, t.plate_id, avg(t.ct_value) as avg_ct
from qpcr_sample_data t
group by t.smpl_id, t.plate_id