如何计算访问权限

时间:2015-10-21 14:54:58

标签: ms-access

专家请告诉我如何算下面的?基本上每次生产4个样品。我只想计算每个单元格(总计超过时间段T1,T2,T3),“16”发生的次数,32,发生等等。请指教。我可以在Excel中完成,但我想使用access作为一个大文件。

Cell    Time    Sample1 Sample2 Sample3 Sample4
A1  T1  16  16  32  Unavailable
B1  T1  16  16  32  Unavailable
C1  T1  160 320 320 Unavailable
A1  T2  80  80  80  Unavailable
B1  T2  80  96  Unavailable Unavailable
C1  T2  160 320 Unavailable Unavailable
A1  T3  16  80  80  96
B1  T3  16  16  16  16

提前致谢。

1 个答案:

答案 0 :(得分:0)

您可以使用联合查询:

Select
    Cell, [Time], Sample1 As Sample
From 
    YourTable
Union All
Select
    Cell, [Time], Sample2 As Sample
From 
    YourTable
Union All
Select
    Cell, [Time], Sample3 As Sample
From 
    YourTable
Union All
Select
    Cell, [Time], Sample4 As Sample
From 
    YourTable

保存并将其用作新查询中的来源:

Select
    Sample, Count(*) As Total
From
    SavedQuery
Group By 
    Sample